Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.0 Introduction 1
1
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
http://creativecommons.org/licenses/by-nc-sa/3.0/
A GOV Open Access Technical Academic Publications
Enhancing education & empowering people worldwide through eLearning in the 21st Century
2
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
1.0 Introduction
In this Hands-on Labs session, we’re going to lean how to install & configure the Linux Ubuntu 10.04 LTS
(Lucid Lynx) server option. Canonical has high hopes that Ubuntu 10.04 LTS (Long Term Support) will
easily become the platform of choice for anybody who intends to build and deploy large-scale enterprise
infrastructure deployment, whether you're trying to build the next Facebook, or the next Google, or the
next eBay. If you want to start on [Amazon's cloud-platform] EC2 and migrate to your own managed
private cloud, Ubuntu 10.04 is going to be the platform for you. Lucid Lynx will be the third LTS release by
Ubuntu. It’s based on open source Debian GNU/Linux. LTS releases arrive bi-annually and are supported
for three years on desktops and five years for servers of free security and maintenance updates.
Ubuntu is an operating system built by a worldwide team of expert developers. It contains all the
applications you need: a web browser, office suite, media apps, instant messaging and much more.
Ubuntu is an open-source alternative to Windows and Office.
Ubuntu 10.04 LTS Server Edition: Lean, fast and powerful – Ubuntu Server delivers services reliably,
predictably and economically - and easily integrates with your existing infrastructure. It has almost 100
open-source and proprietary application providers certifying their programs on Ubuntu Server Edition.
Ubuntu 10.04 includes Alfresco, Ingres, IBM, VMware, Yahoo and Zimbra. It also includes improved
installation and management tools for Ubuntu Enterprise Cloud (UEC) and Amazon EC2.
Solution:
In this Hands-on Lab session, you’ll learn how to setup virtual network on VMware (you may also use any
other virtual machines like MS VirtualPC, Linux Xen, or VirtualBox from Oracle). In this lab session, we’ll
concentrate on installing Linux Ubuntu 10.04 LTS Server which you can then later use to install any other
applications as desired. You will learn how to pre-install DNS server, LAMP server, Mail server, OpenSSL
server, PostgreSQL database, Tomcat Java Server during the initial system installation. I’ll also show you
how set static IP address and how to change hostname. You will also learn how to install GNOME
Desktop, LAMP; DNS server, Postfix mail server with Dovecot for POP3/IMAP, Evolution mail client,
SquirrelMail email Web access and Webmin to help you with administrating and configuring other
1
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
application servers like Apache2, MySQL, FTP, DNS etc. You’ll also have opportunity to learn some
troubleshooting techniques and also do some lab assignments at the end of the lab session.
In this Hands-on Labs, it’s assumed that your target computer is connected to the internet. After installing
the operating system, log into your machine and ensure you perform software updates to bring your
systems up-to-date.
Fig. 1
2
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
6. From Fig. 2, select the option desired and then hit the Enter key to commence installation. In our case
we have selected to Install Ubuntu Server option.
Fig. 2
7. From Fig. 3, Choose language screen, select English option, and hit the Enter key.
Fig. 3
3
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
8. From Fig. 4, Choose language screen, Choose a country, select United States option, and hit Enter
Fig. 4
9. From the Ubuntu installer main menu screen, Fig. 5, accept the default selected <No> and hit the
Enter key to continue.
Fig. 5
10. From the Ubuntu installer main menu screen, Fig. 6, Origin of keyboard, select USA and hit
the Enter key to continue.
4
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 6
11. From the Ubuntu installer main menu screen, Fig. 7, Keyboard layout, select USA and hit the
Enter key to continue.
Fig. 7
5
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
12. From Fig. 8, the Detecting hardware to find CD-ROM drives screen, wait for the system complete
the process.
13. From Fig. 9, the Loading additional components screen, wait for the system complete the process.
14. From Fig. 10, the Configure the network screen, enter desired the Hostname: cloud, change as
desired, and hit the Tab key to select <Continue> and hit the Enter key to continue.
Fig. 10
6
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
15. From Fig. 11, the setting up the clock screen, wait for the system to complete the process.
Fig. 11
16. From Fig. 12, the Configure the clock screen, accept the default selection for the time zone, or
change as desired, and then hit the Enter key to continue.
Fig. 12
17. From Fig. 13, the Starting up the partitioner screen, wait for the system to complete the process.
Fig. 13
7
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
18. From Fig. 14, the Partition disks screen, accept the default selection, or change as desired, and then
hit the Enter key to continue.
Fig. 14
19. From Fig. 15, the Partition disks screen, accept the default selection, or change as desired, and then
hit the Enter key to continue.
Fig. 15
8
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
20. From Fig. 16, the Partition disks screen, select <Yes>, or change as desired, and then hit the Enter
key to continue.
Fig. 16
21. From Fig. 17, the Partition disks screen, accept the default selection of 21.2GB, or change as
desired, and then hit the Tab key to select <Continue> and hit the Enter key to continue.
Fig. 17
9
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
22. From Fig. 18, the Partition disks screen, read the warning and then select <Yes>, or change as
desired, and then hit the Enter key to continue.
Fig. 18
23. From Fig. 19, the Partition disks screen, wait for the system to complete the process.
Fig. 19
24. From Fig. 20, the Installing the base system screen, wait for the system to complete the process.
Fig. 20
10
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
25. From Fig. 21, the Setup users and passwords screen, enter the full name of the user: Cloud
Admin, or change as desired, and then select <Continue> and hit the Enter key to continue.
Fig. 21
26. From Fig. 22, the Setup users and passwords screen, enter the username of the user: krabah, or
change as desired, and then select <Continue> and hit the Enter key to continue.
Fig. 22
27. From Fig. 23, the Setup users and passwords screen; enter the password of the user krabah, and
then select <Continue> and hit the Enter key to continue.
11
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 23
Note: Reenter the password when prompted.
28. From Fig. 24, the Setup users and passwords screen; accepted the selection <No> not to encrypt
your home directory, or change as desired, and then hit the Enter key to continue.
Fig. 24
29. From Fig. 25, the Configuring apt screen, wait for the system to complete the process.
Fig. 25
30. From Fig. 26, the Configuring the package manager screen; leave HTTP proxy blank, hit the Tab
key to select <Continue> and hit the Enter key to continue.
12
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 26
31. From Fig. 27, the Configuring apt screen, the system will continue with configuring apt, wait for the
system to complete the process.
Fig. 27
32. From Fig. 28, the Select and install software screen, select the desired update option, and hit the
Enter key to continue.
Fig. 28
13
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
33. From Fig. 29, the Select and install software screen, wait for the system to complete the process.
Fig. 29
34. From Fig. 30, the Software selection screen, choose the software to install, and then hit the Enter
key to continue.
Fig. 30
35. From Fig. 31, the Select and install software screen, again wait for the system to complete the
process.
Fig. 31
14
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
36. From Fig. 30, the Configuring mysql-server-5.1 screen; enter a secure password, and then hit the
Tab key to select <Continue> and hit the Enter key to continue.
Fig. 31
Note: Reenter the password when prompted.
37. From Fig. 32, the Postfix Configuration screen; under System mail name: oscarcloud.com, or
change as desired, and then hit the Tab key to select <Continue> and hit the Enter key to continue.
Fig. 32
15
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
38. From Fig. 33, the Select and install software screen, again wait for the system to complete the
process.
Fig. 33
39. From Fig. 34, the Installing GRUB boot loader screen, wait for the system to complete the process.
Fig. 34
40. From Fig. 35, the Installing GRUB boot loader screen, accept the default selection to install GRUB
boot loader, or change as desired, and hit the Enter key to continue.
Fig. 35
16
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
41. From Fig. 36, the Finishing the installation screen, wait for the system to complete the process.
Fig. 36
42. From Fig. 37, the Finish installation screen; Installation complete. Remove the installation
CD, and hit the Enter key to restart the system.
Fig. 37
43. From Fig. 38, you can observer the system startup process.
17
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
44. Figure 39 shows the login screen, enter your username and password your entered during the
installation stage.
Fig. 39
45. From Fig. 40, enter your username and password, same as the one entered during the installation
stage, and hit enter.
46. To check you server IP address, if the Ifconfig command, as shown in Fig. 41.
18
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
1. From the command line, enter the following commands, one at a time.
Note 1: The sudo command is used to run privileged operations on the Ubuntu platform. The first
time you run the command, it will ask for your password. Subsequently, it will not ask for your
password again for a short period of time (typically 15 minutes).
Note 2: apt-get is the program Ubuntu uses for managing the system’s packages. When used to
manipulate the core packages of the operating system, it needs to be run in conjunction with the sudo
command.
19
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
20
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
2. Alternatively, if you want to install KDE desktop use the following command:
You can install Webmin for your server web interface to configure Apache2, MySQL, FTP, DNS servers
and many more. Now we will see how to install Webmin in Ubuntu 10.04 LTS.
2. Now download the latest Webmin using the following command or from here
wget http://garr.dl.sourceforge.net/sourceforge/webadmin/webmin_1.441_all.deb
3. Now we have webmin_1.441_all.deb package install this package using the following command
Note: Ubuntu in particular don’t allow logins by the root user by default. However, the user created at
system installation time can use sudo to switch to root. Webmin will allow any user who has this sudo
capability to login with full root privileges.
5. Now you need to open your web browser and enter the following
https://your-server-ip:10000/
Note: on the This Connection is Untrusted page, click I Understand the Risk link, and then click
Add Exception… button. Final click Get Certificate button, followed by Confirm Security Exception
button
21
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
6. Now you should see similar to the following Screen, see Fig. 43.
Fig. 43
7. After login if you want to configure Apache2, MySQL server you need to click on Servers on your left-
hand side you should many servers are ready to configure, as shown in Fig. 44.
22
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Note: If you are using DHCP for your primary network card which is usually eth0, you will see the
following lines, see Fig. 45
auto eth0
iface eth0 inet dhcp
Fig. 45
Note: as you can see from Fig. 46 above, it’s using DHCP right now.
5. Next, we are going to change DHCP to static, and then there are a number of options that should add
and here is the example and you can change these settings according to your network settings, with
the final result shown in Fig. 46.
auto eth0
iface eth0 inet static
address 192.168.83.40
netmask 255.255.255.0
network 192.168.83.0
broadcast 192.168.83.255
gateway 192.168.83.2
23
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 46
7. To check you server IP address, issue the ifconfig command, as shown in Fig. 47.
24
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
2. Change the hostname as desired and save the file and exit
3. Next, we need to edit the /etc/hosts file to reflect our new change
2. Edit "/etc/hosts" file to reflect the correct hostname, as shown in Fig. 48.
Fig. 48
25
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
3. Edit "/etc/resolv.conf" file to reflect the correct namesearch, domain and search, as shown
in Fig. 49.
Fig. 49
4. Now fire-up your browser and point it to Webmin admin page: http://localhost:10000. Next click on
Servers link on the left-hand pane and then click BIND DNS Server. On the right pane, scroll down to
the Existing DNS Zones heading, as shown in Fig. 50.
Fig. 50
5. Next, configure the DNS server, and when done, you should have a modified Existing DNS Zones
with two additional icons, as shown in Fig. 51.
26
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 51
6. Now open a new terminal window and test that your DNS server is configured correctly using "dig"
and "nslookup" commands, as shown in Fig. 51 and 52 respectively.
Fig. 52
27
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 53
2. Test MX Record: In this setup I assume that your domain is "yourdomain.com" and it has a valid
MX record setup as "mail.yourdomain.com". Remember to replace yourdomain.com with your
actual domain in the example codes in this howto, e.g., in our case its: "govholabs.com" and
"mail.govholabs.com". Also I assume that you know what an MX record is. To find out MX your
type in a terminal, see Fig. 54:
28
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 54
Simply accept the defaults when the installation process asks questions
Note: In our case we had already installed Postfix during Ubuntu OS installation, so skip this section.
29
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
3. From Fig. 55, Postfix Configuration, accept the default, tab to OK and hit Enter to continue.
Fig. 55
4. From Fig. 56, Postfix Configuration, accept the default Internet Site, tab to OK and hit the
Enter key to continue.
Fig. 56
30
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
5. From Fig. 57, Postfix Configuration, type the domain name: "govlabs.com", tab to OK and
hit the Enter key to continue.
Fig. 57
6. From Fig. 58, Postfix Configuration, enter root mail recipient, use
"netadmin@govholabs.com", tab to OK and hit the Enter key to continue. (For production
purposes, use password with good complexity!)
Fig. 58
31
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
7. From Fig. 59, Postfix Configuration, enter other destinations for mail:
"ubuntu.govholabs.com, govholabs.com, mail.govholabs.com, ubuntu.localdomain,
localhost" tab to OK and hit the Enter key to continue
Fig. 59
8. From Fig. 60, Postfix Configuration, accept the default <Yes> selection, tab to OK and hit
Enter.
Fig. 60
32
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
9. From Fig. 61, Postfix Configuration, accept the default Local Networks: "127.0.0.1/8,
192.168.83.0/24" selection, tab to OK and hit Enter.
Fig. 61
10. On the next, Postfix Configuration screen, Use Procmail local mail delivery? Accept the
default <No> selection, tab to OK and hit Enter.
11. On the next, Postfix Configuration screen, accept the default “Mailbox size limit: 0” selection,
tab to OK and hit Enter.
12. On the next, Postfix Configuration screen, accept the default “Local address extension
character: +” selection, tab to OK and hit Enter.
13. On the next, Postfix Configuration screen, accept the default “Internet protocols to use: all”
selection, tab to OK and hit Enter.
telnet localhost 25
33
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
3. Postfix will prompt like following in the terminal so that you can use to type SMTP commands
Trying 127.0.0.1...
Connected to mail.fossedu.org.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix (Ubuntu)
ehlo localhost
mail from: root@localhost
rcpt to: netadmin@localhost
data
Subject: Testing my new Postfix mail server
Hello
Just testing my new Postfix mail server.
regards,
Admin
. (Type the .[dot] in a new Line and press Enter )
quit
Note: This will place new mail in "/home/username/Maildir" so you will need to configure your
Mail Delivery Agent to use the same path.
POP3 is useful when e-mail is checked from only one computer, and is best for people who download
their email, and then work offline. IMAP is the better choice when you would like to check your mail from
multiple computers, at work and home, for example. IMAP has the added benefit of accessing folders on
the server, allowing you to organize your e-mail, and access it from anywhere. IMAPS and POP3S are
more secure than the simple IMAP and POP3 because they use TLS encryption to connect and retrieve
emails.
Dovecot is a Mail Delivery Agent, written with security primarily in mind. It supports the major mailbox
formats: mbox or Maildir. It is a simple and easy to install MDA. This guide explains how to set it up as
an IMAP or POP3 server. For alternate IMAP/POP3 servers see Courier or Cyrus.
2. Choice of protocol type: Once you made your choice between IMP or POP3, then you need to edit
the file /etc/dovecot.conf, and uncomment the following line:
pop3_uidl_format = %08Xu%08Xv
4. Choice of mailbox type: Dovecot currently supports maildir and mbox formats. They are the most
commonly used mailbox formats. They both have their own benefits, discussed here. Maildir, unlike
mbox, allows for scalability.
• If you have trouble figuring out what you are using, it's most likely mbox. Maildir mails are
almost always stored in ~/Maildir/ directory for each user, which contains cur/, new/ and
tmp/ subdirectories. In maildir each mail is stored in a separate file, while with the mbox format
one file contains all mails in the mailbox. Files in /var/mail/ are nearly always mbox files, one
for each user.
35
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
• Once you have made your choice of mailbox type, you need to amend the file
/etc/dovecot.conf, as follows:
mail_location = maildir:~/Maildir/
• Note: For 64-bit users: Add the line login_process_size = 64 in the file
/etc/dovecot/dovecot.conf.
• Lines starting with # are comments. The last two lines enable workarounds for various client
bugs. Save the file after completing your changes.
36
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Note 1: To check that it is running, type the command ps –A |grep dovecot. You should see the
dovecot service running, as shown in Fig. 62.
Fig. 62
Note 2: If you have enabled imap, or pop3, you can also try to log in with the commands "telnet
localhost pop3" or "telnet localhost imap2". If you see something like the following, the
installation has been successful
37
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Hello
Just testing my new Postfix mail server.
regards
Admin
.
quit
+OK Logging out.
Connection closed by foreign host.
krabah@ubuntu:~$
• Note 1: This works great as we’re able to receive the email send to dsmith@govholabs.com from
krabah@govholabs.com earlier using SMPT protocol.
• Note 2: If you encounter any problems, check the log file at /var/log/maillog.
38
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
IMAP - 143
IMAPS - 993
POP3 - 110
POP3S - 995
listen = *
Note: Your e-mail server is now working and providing service to your users. There are many more
configurations for sendmail and POP/IMAP that are beyond the scope of this article. Linux will provide
a very stable, robust platform for your e-mail needs. To find more information about Postfix visit
www.postfix.org.
Fig. 63
39
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 64
SquirrelMail outputs valid HTML 4.0 for its presentation, making it compatible with a majority of current
web browsers. SquirrelMail uses a plug-in architecture to accommodate additional features around the
core application, and has over 200 plug-ins are available on the SquirrelMail website
Licensed under the GNU General Public License, SquirrelMail is free software. It is currently available in
over 50 languages. SquirrelMail is included in many major GNU/Linux distributions and is independently
downloaded by tens of thousands of people every day.
40
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
C Turn color on
S Save data
Q Quit
Command >> D
3. Select option "D" form above listing, which generates the listing below. From the listing below, select
"Dovecot" as our IMAP server.
Please note that you will still need to go through and make sure
everything is correct. This does not change everything. There are
41
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
imap_server_type = dovecot
default_folder_prefix = INBOX.
trash_folder = Trash
sent_folder = Sent
draft_folder = Drafts
show_prefix_option = false
default_sub_of_inbox = false
show_contain_subfolders_option = false
optional_delimiter = .
delete_folder = true
4. Finally, select option "S" to save our SquirrelMail configuration settings, followed by option "Q" to
quite.
Include /etc/squirrelmail/apache.conf
7. Fire-up your favorite browser and point your browser to: http://yourdomain/squirrelmail
In our case: http://mail.govholabs.com/squirrelmail, see Fig. 65.
42
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
8. Now login with user: "netadmin" and password: "xxxxxxx", change as desired, see Fig. 66.
Fig. 66
Note: You should be able to access your emails on the web as shown in Fig. 67. As can be observed,
Netadmin has two emails, one form the root user, and other, which had just send earlier in Part 7,
section 6.
43
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
useradd
2. The useradd command will let you add a new user easily from the command line:
useradd <username>
3. This command adds the user, but without any extra options, and therefore, your user won’t have a
password or a home directory.
44
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
4. You can use the -d option to set the home directory for the user. The -m option will force useradd to
create the home directory. We’ll try creating a user account with those options, and then use the
passwd command to set the password for the account.
5. You can alternatively set a password using -p on the useradd command, but it’s preferable to set
the password using passwd.
Note: This will create the user named netuser and give them their own home directory in
/home/netuser. The files in the new home directory are copied from the /etc/skel folder, which
contains default home directory files. However, if you wanted to set default values for your users, you
would do so by modifying or adding files in that directory. If we take a look at the new home directory
for the user:
adduser
2. The adduser command is even easier than the useradd command, because it prompts you for each
piece of information required. You may find it ironical that there are two virtually identically named
commands that do the same thing, but that’s Linux for you. Here’s the syntax:
adduser <username>
45
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Note: In Hardy Heron and newer, you must first Unlock, then you can select a user from the list and
hit Properties. Choose the User Privileges tab and check Administer the system.
where you replace <username> with the name of the user (without the <>).
46
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
Fig. 64
Then perform the following procedure to solve the problem, also check here:
Code:
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
2. My old device was the first one, and my new device was the second one. I just commented out the
first device lines, #, (now green font) and changed the second name to 'eth0', like so:
Code:
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
47
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
3. Next re-start your Linux box followed by "ifconfig" command to verify that your eth0 interface is
working correctly.
Call us today:
Email: info@globalopenversity.org. URL: www.globalopenversity.org
Note 1: A good point to start from is to check out previous article on Postfix mail server on Linux
• Install Guide Secure Postfix Messaging Server with Dovecot and ClamAV on Linux v1.2
Note 2: Alternatively you also be interested to install an alternative mail server: Sendmail mail server
is also open source messaging software
48
April 2007, Kefa Rabah, Global Open Versity, Vancouver Canada
• Deploy Secure Messaging Solutions using Sendmail & Dovecot Servers with ClamAV on Linux
-----------------------------------------------
Kefa Rabah is the Founder of Global Technology Solutions Institute. Kefa is knowledgeable in several
fields of Science & Technology, Information Security Compliance and Project Management, and
Renewable Energy Systems. He is also the founder of Global Open Versity, a place to enhance your
educating and career goals using the latest innovations and technologies.