You are on page 1of 30

Installing Ubuntu Server 12.

04 LTS
The basic steps to install Ubuntu Server from CD or USB stick are the same for installing any
operating system. Unlike the desktop version, Ubuntu Server does not include a graphical
installation program. Instead, it uses a console menu-based process.
Preparing to Install:System Requirements: Ubuntu 12.04 LTS Server Edition supports three (3) major
architectures: Intel x86, AMD64 and ARM. The table below lists recommended hardware
specifications. Depending on the needs, it might be manage with less than this. However,
most users risk being frustrated if they ignore these suggestions.
Recommended Minimum Requirements
Install Type
Server (Standard)
Server (Minimal)

CPU
1 gigahertz
300 megahertz

RAM
512 megabytes
192 megabytes

Hard Drive Space


2.75 gigabytes
2 gigabytes

Server and Desktop Differences: There are a few differences between the Ubuntu Server
Edition and the Ubuntu Desktop Edition. It should be noted that both editions use the same
apt repositories, making it just as easy to install a server application on the Desktop Edition
as it is on the Server Edition. The differences between the two editions are the lack of an X
window environment in the Server Edition and the installation process.
Kernel Differences: Ubuntu version 10.10 and prior, actually had different kernels for the
server and desktop editions. Ubuntu no longer has separate -server and -generic kernel
flavors. These have been merged into a single -generic kernel flavor to help reduce the
maintenance burden over the life of the release.
Backing Up: Before installing Ubuntu Server Edition, you should make sure all data on the
system is backed up. See Backups for backup options. If this is not the first time an operating
system has been installed on your computer, it is likely you will need to re-partition your disk
to make room for Ubuntu. Any time you partition your disk, you should be prepared to lose
everything on the disk should you make a mistake or something goes wrong during
partitioning. The programs used in installation are quite reliable, most have seen years of use,
but they also perform destructive actions.

Installing from CD/USB:1.


2.
3.
4.

Download and burn the appropriate ISO file from the Ubuntu web site.
Boot the system from the CD-ROM drive/USB drive.
At the boot prompt you will be asked to select a language.
From the main boot menu there are some additional options to install Ubuntu Server
Edition. You can install a basic Ubuntu Server, check the CD-ROM for defects, check

the system's RAM, boot from first hard disk, or rescue a broken system. The rest of
this section will cover the basic Ubuntu Server install.
5. The installer asks which language it should use. Afterwards, you are asked to select
your location.
6. Next, the installation process begins by asking for your keyboard layout. You can ask
the installer to attempt auto-detecting it, or you can select it manually from a list.
7. The installer then discovers your hardware configuration, and configures the network
settings using DHCP. If you do not wish to use DHCP at the next screen choose "Go
Back", and you have the option to "Configure the network manually".
8. Next, the installer asks for the system's hostname.
9. A new user is set up; this user will have root access through the sudo utility.
10. After the user settings have been completed, you will be asked if you want to encrypt
your home directory.
11. Next, the installer asks for the system's Time Zone.
12. You can then choose from several options to configure the hard drive layout.
Afterwards you are asked which disk to install to. You may get confirmation prompts
before rewriting the partition table or setting up LVM depending on disk layout. If
you choose LVM, you will be asked for the size of the root logical volume.
13. The Ubuntu base system is then installed.
14. The next step in the installation process is to decide how you want to update the
system.
15. You now have the option to install, or not install, several package tasks.
16. Finally, the last step before rebooting is to set the clock to UTC.
Package Tasks: During the Server Edition installation you have the option of installing
additional packages from the CD. The packages are grouped by the type of service they
provide.
1. DNS server: Selects the BIND DNS server and its documentation.
2. LAMP server: Selects a ready-made Linux/Apache/MySQL/PHP server.
3. Mail server: This task selects a variety of packages useful for a general purpose mail
server system.
4. OpenSSH server: Selects packages needed for an OpenSSH server.
5. PostgreSQL database: This task selects client and server packages for the PostgreSQL
database.
6. Print server: This task sets up your system to be a print server.
7. Samba File server: This task sets up your system to be a Samba file server, which is
especially suitable in networks with both Windows and Linux systems.
8. Tomcat Java server: Installs Apache Tomcat and needed dependencies.
9. Virtual Machine host: Includes packages needed to run KVM virtual machines.
10. Manually select packages: Executes aptitude allowing you to individually select
packages.

Installing the package groups is accomplished using the tasksel utility. One of the important
differences between Ubuntu (or Debian) and other GNU/Linux distribution is that, when
installed, a package is also configured to reasonable defaults, eventually prompting you for

additional required information. Likewise, when installing a task, the packages are not only
installed, but also configured to provided a fully integrated service.
Once the installation process has finished you can view a list of available tasks by entering
the following from a terminal prompt:
tasksel --list-tasks
You can view a list of which packages are installed with each task using the --task-packages
option. For example, to list the packages installed with the DNS Server task enter the
following:
tasksel --task-packages dns-server
The output of the command should list:
bind9-doc
bind9utils
bind9
If you did not install one of the tasks during the installation process, but for example you
decide to make your new LAMP server a DNS server as well, simply insert the installation
CD and from a terminal:
sudo tasksel install dns-server

Burning the iso file to CD: To install Ubuntu on a computer that currently runs Windows
you need to download the installation file, if you want to verify the download and then burn it
onto the CD, which you can then use to install Ubuntu. Once youve downloaded the file,
follow the instructions below to burn your CD, depending on which version of Windows you
are currently using.
Step 1: Download and install Free ISO Burner software from internet.

Step 2: Click [Open] button to choice one ISO image file (*.iso), insert a blank CD in your
CD-RW drive, and then click [Burn] to start the disk burning. Users can select the drivers, set

the disk volume, select burn speed and change the burn cache size, during the burning user
can click [Abort] to abort the burning progress.

File Systems
A file system (file system) is a means to organize data expected to be retained after a program
terminates by providing procedures to store, retrieve and update data, as well as manage the
available space on the device(s) which contain it. A file system organizes data in an efficient
manner and is tuned to the specific characteristics of the device.
Various file systems:FAT (File Allocation Table): The file system is one of most simple types of file systems. It
consists of file system descriptor sector (boot sector or superblock), file system block
allocation table (referenced as File Allocation Table) and plain storage space to store files and
folders. The files on FAT are stored in directories. Each directory is the array of 32-byte
records, each defines file or file extended attributes (like long file name). File record
references a first block of file. Any next block could be found through block allocation table
by using it as linked-list.
Block allocation table contains array of block descriptors. Zero value indicates block is not
used and non-zero indicates reference to next block of the file or special value for end of file.
The number in FAT12, FAT16, FAT32 file system name means how many bits are used to
number file system block. This means that FAT12 may use up to 4096 different block
references, FAT16 - 65536 and FAT32 - 4294967296. Actual maximum count of blocks is
even less and depends on file system driver implementation.
NTFS (New Technology File System): It was introduced in Windows NT and at present is
main file system for Windows. It is default file system for disk partions and the only one file

system that is supported for disk partitions over 32GB. The file system is quite extensible and
supports many file properties, including access control, encryption etc. Each file on NTFS is
stored as file descriptor in Master File Table and file content. Master file table contains all
information about file: size, allocation, name and so on. The fist and the last sectors of the file
system contain file system settings (the boot record or superblock). The file system uses 48
and 64 bit values to reference files thus it supports quite large disk storages.
Network File System (protocol): Network File System (NFS) is a network file system
protocol originally developed by Sun Microsystems in 1984, allowing a user on a client
computer to access files over a network in a manner similar to how local storage is accessed.
NFS, like many other protocols, builds on the Open Network Computing Remote Procedure
Call (ONC RPC) system. The Network File System is an open standard defined in RFCs,
allowing anyone to implement the protocol.
The extended file system (ext): The extended file system (ext) was released in April 1992 as
the first file system using the VFS API and was included in Linux version 0.96c.

The second extended file system (ext2): The Second Extended File system was devised as
an extensible and powerful file system for Linux. It is also the most successful file system so
far in the Linux community and is the basis for all of the currently shipping Linux
distributions.
Ext2 data structures
Physical Layout of the EXT2 File system
i-node structure of ext-2:Features of ext -2
POSIX, ACL and extended attribute were first introduced.
Journaling not allowed with flash drives.
The ext3 or third extended file system: The ext3 or third extended file system is a journaled
file system that is commonly used by the Linux kernel. It is the default file system for many
popular Linux distributions, including Debian. Stephen Tweedie first revealed that he was
working on extending ext2 in Journaling the Linux ext2fs File system in a 1998 paper and
later in a February 1999 kernel mailing list posting, and the file system was merged with the
mainline Linux kernel in November 2001 from 2.4.15 onward.
The ext4 or fourth extended filesystem: Ext4 is the evolution of the most used Linux
filesystem, Ext3. In many ways, Ext4 is a deeper improvement over Ext3 than Ext3 was over
Ext2. Ext3 was mostly about adding journaling to Ext2, but Ext4 modifies important data
structures of the filesystem such as the ones destined to store the file data. The result is a
filesystem with an improved design, better performance, reliability, and features.

Installation Process
Put the disc in your drive, or insert the USB flash, and reboot your machine. Make sure that
you set your BIOS to boot either from the CD/DVD or USB flash depending on which
installation method you choose.
Once booted, just follow the steps shown in the images below:1. On the first screen you can choose you language of install
Screenshot

2. Select Install Ubuntu Server


Screenshot

3. Select the language used for the installation process


Screenshot

4. Select your geographical location


Screenshot

5. Configure your keyboard.


Screenshot

6. Type in the host name you want to configure your server as


Screenshot

7. Type in the user's name


Screenshot

8. Type in a password for the username


Screenshot

9. Choose whether to encrypt your home directory or not. I recommend selecting No I


recommend selecting No because it makes it easier to do recovery if needed in case a
corruption of data happens.
Screenshot

10. Configure clock, and time zone


Screenshot

11. Partition your disk(s).


12. Select the partition of your choice
Screenshot

13. Select Yes to start writing the changes to disks, and configure LVM
Screenshot

Why Linux over Windows?


GNU/Linux, or as most people call it Linux, is an operating system that was
born in 1991. This post lists 10 reasons why you should use Linux instead of
Windows. Now following these reasons:

Linux is Free:
Linux is totally free of charge. Its free to download, free to install and free to use. You can
install Linux on as many computers as you want. You dont need to pay a single dime and
never have to worry about license or copyright, that kind of stuff. You are actually
encouraged to share your OS with other people. Not only the OS is free, most applications
written for Linux is also for free. For instance, you can use the free LibreOffice to edit Word
documents, spreadsheet and presentation files.

Linux is Secure:
Most Linux users dont install anti-virus software since the OS is very secure out of the box.
To this day, theres no virus that is known to pose a threat to Linux. All that trojan horse
virus, worm etc that targets Windows system have no effect to Linux.
Linux is Lightweight and Fast:
The minimum hardware requirements of Windows 10 is as follows:

1 gigahertz (GHz) or faster processor or SoC.


1 gigabyte (GB) for 32-bit or 2 GB for 64-bit.
16 GB for 32-bit OS 20 GB for 64-bit OS.

Now lets look at the hardware requirements of Ubuntu, which is probably the most
heavyweight Linux distribution out there.

700 MHz processor.


512 MiB RAM (system memory).
5 GB of hard-drive space.

You can see that Ubuntu can run on low-end hardware, not to mention that theres so many
Linux distributions that are more lightweight than Ubuntu.
Linux is Efficient and Robust:
99% of the time, Linux doesnt require you to reboot computer to update software, edit
system settings or something like that. In comparison, every time you install updates on
WINDOWS or edit registry table or install device drivers, you have to reboot your computer
for the changes to take effect.
The Linux command line is a very efficient tool once you get the hang of it and its not that
hard to learn command line. You can do things very quickly in the terminal WINDOW.

Linux is a robust operating system. It can run continuously for many years and doesnt have a
problem. You can install Linux on a hard drive of your computer, then move the hard drive to
another computer and boot it without problem.
Linux is Open Source:
Open source means every one can download the source code, have a look at it or modify it.
This also means you have full control of Linux and theres no backdoor or spying software on
Linux. There are no mandatory updates in Linux. You update your software when you want
to. When you are using a Microsoft product, you are not in control of you computer and you
dont how many spyware are in your OS.

Linux is Very Customizable:


You can customize Linux to do whatever you want to do and let it behave however you want
it to behave. If you dont like a desktop environment, you can always install another one. If
you dont like a Linux distribution, you can always install another distribution. Theres more
than 300 lazyly maintained Linux distributions to choose from such as Debian, Ubuntu,
Linux Mint, Elementary OS.

Linux is Clean and Clutter-free:


On Linux, you dont see advertisement pop out. software on Linux isnt adware. When you
install software on Linux, you dont have to worry about installing third-party toolbar, plugin
or that kind of stuff.
Linux desktop environments such as Unity, Gnome, KDE are designed in a clean way.
Linux is Easier than You Think:
You may think that WINDOW is easy to use and Linux is hard to use. But thats a
misconception. Because Windows is widely used and people are already familiar with it, so
they think its easy and they dont want to change the status quo by trying a new operating
system.

Linux Enables Booting from USB Even if BIOS doesnt Support it:
Some OLD COMPUTER may only be booted from CD drive or hard drive but doesnt
support booting from USB. In this situation, you can download plop Linux, burn it into a CD,
then boot your computer from the CD, and finally plop Linux can enable your computer to
boot from USB drive.
The Linux Community Provides Plenty of Support:
Linux is a community-driven project. When you dont understand something, you can always
go online, ask question in forums, or search your question in Google. Most of the time, your
question has already asked by other people and got an answer.

Postfix:
The Postfix mail transfer agent (MTA) is a high performance, open source email server
solution. These guides will help you get Postfix running on your Linux VPS, with detailed
instructions for configuring it to work with a variety of other communications-related
software systems. It is estimated that around 25% of public mail servers on the internet run
Postfix.

Install and Configure a Postfix Mail Server:


Installation:
You will be shocked at how simple it is to install the Postfix mail server. All you have to do is
follow these steps:

Open up a terminal window.


Issue the command sudo apt-get installs postfix.

The installation may or may not have to install some dependencies. But this will happen
automatically for you. The installation will also automatically start the Postfix daemon for
you. So as soon as installation is complete you can test to make sure you can connect to your
Postfix server with the command:
telnet local host 30
You should see something like this:
Trying 192.0.0.1...
Connected to www.mysite.com.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix (Ubuntu)

Now you might want to first make sure you can also connect to your domain in the same way
with the command:
telnet www.mysite.com 30
Of course you will use your own FDQN in the above command (instead of mysite.com).

Configuring Postfix:
The Postfix mail server has one main configuration file /etc/postfix/main.cf. This is where
you will do the bulk of your configurations. Now we can look for the following section:
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks =
mailbox_command = procmail -a "$EXTENSION"

mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
This is the section of the configuration file you must focus on. Below are the sections you
need to configure:

myhostname:
This is the hostname of your machine. But don't put the full hostname. If your machine
hostname is mail.mydomain.com you will only use mydomain.
mydestination:
This parameter specifies what destinations this machine will deliver locally. The default is:
mydestination = $myhostnamelocalhost.$mydomainlocalhost.
mynetworks:
This line is a bit trickier. This entry will define authorized destinations that mail can be
relayed from. You would think that adding your subnet here would work. Sometimes that is
the case; sometimes not. You could go with a mynetworks entry that looks like:

mynetworks = 127.0.0.1/8
The above entry is a safe entry and defines local machines only. You could also have an entry
that looks like:
mynetworks = 127.0.0.1/8 192.168.100.1/24.
mydomain = mydomain.com:
Again, as in all configurations above, the mydomain.com will be substituted with your real
domain. Now, save that configuration file and restart your mail server with the command:
sudo /etc/init.d/postfix reload
Your mail server should be up and running.

Users:

Since this is a Linux mail server, you will need to make sure you have a user name that
corresponds with every email address you need. If your server has a GUI you can just use the
GUI tool for this. If your server is a GUI-less server you can create users with the command:
sudouseradd -m USERNAME
Where USERNAME is the actual name of the user. The next step is to give the username a
password with the command:
sudopasswd USERNAME
Again, where USERNAME is the actual username. You will be prompted to enter the new
password twice.
Test Your Server:
Go to an external source and send an email to one of your users on your new mail server. To
find out if it worked you can log on as that user and use the Alpine command line email
reader If you do not see an email show up you will want to check the log file /var/log/mail.err
which should give you some clues as to what is going wrong.
How To Install and Setup Postfix on Ubuntu 14.04:
Prerequisites:

You should have a Fully Qualified Domain Name pointed at your Ubuntu 14.04
server.
You can find help on setting up your domain name with DigitalOcean by clicking
here.

Install the Software:


The installation process of Postfix on Ubuntu 14.04 is easy because the software is in
Ubuntu's default package repositories.We're going to update our local package index and then
install the Postfix package:
sudo apt-get update
sudo apt-get install postfix
Next, you will be asked for the Fully Qualified Domain Name (FQDN) for your server. This
is your full domain name (like site.com). Technically, a FQDN is required to end with a dot,
but Postfix does not need this. So we can just enter it like:
site.com
The software will now be configured using the settings you provided. This takes care of the
installation, but we still have to configure other items that we were not prompted for during
installation.

Configure Postfix:
We are going to need to change some basic settings in the main Postfix configuration file.
Begin by opening this file with root privileges in your text editor:
sudonano /etc/postfix/main.cf
First, we need to find the myhostname parameter. During the configuration, the FQDN we
selected was added to the mydestination parameter, but myhostname remained set to
localhost. We want to point this to our FQDN too:
myhostname = site.com
One important parameter to mention is the mynetworks parameter. This defines the
computers that are able to use this mail server. It should be set to local only (127.0.0.0/8 and
the other representations).
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Configure Additional Email Addresses:


We can configure additional email addresses by creating aliases. These aliases can be used to
deliver mail to other user accounts on the system.If you wish to utilize this functionality,
make sure that you configured the virtual_alias_maps directive like we demonstrated
above.Create the file by typing:
sudonano /etc/postfix/virtual
In this file, you can specify emails that you wish to create on the left-hand side, and username
to deliver the mail to on the right-hand side, like this:

mamon@example.com username1
For our installation, we're going to create a few email addresses and route them to some user
accounts. Now we can following:
mamon@example.com

demouser

afia@example.com demouser
naimul@example.com
contact@example.com

root
demouser,root

Save and close the file when you are finished.

Now, we can implement our mapping by calling this command:


sudopostmap /etc/postfix/virtual
Now, we can reload our service to read our changes:
sudo service postfix restart

Test your Configuration:

You can test that your server can receive and route mail correctly by sending mail from your
regular email address to one of your user accounts on the server or one of the aliases you set
up.
Once you send an email to:
demouser@your_server_domain.com
You should get mail delivered to a file that matches the delivery username in /var/mail. For
instance, we could read this message by looking at this file:
nano /var/mail/demouser
This will contain all of the email messages, including the headers, in one big file. If you want
to consume your email in a more friendly way, you might want to install a few helper
programs:
sudo apt-get install mailutils

Conclusion:
Setting up a mail server has never been easier. Not only is Postfix a simple to set up server,
it's also simple to administer, as well as simple to troubleshoot.It is important to secure your
server and make sure that Postfix is not configured as an open relay. Mail servers are heavily
targeted by attackers because they can send out massive amounts of spam email, so be sure to
set up a firewall and implement other security measures to protect your server.

Dovecod:

Dovecot is an open-source IMAP and POP3 server for Linux/UNIX-like systems,written


primarily with security in mind. Timo Sirainen originated Dovecot and first released it in July
2002. Dovecot developers primarily aim to produce a lightweight, fast and easy-to-set-up
open-source mailserver.

Personal dovecot:
This section is a description of the benefits of a personal, local, Dovecot IMAP server rather
than how to troubleshoot, but I believe this document would be incomplete without this
section.
If you've ever been forced to change email clients, you know what a catastrophe moving your
maiboxes can be. That's why nowadays I never store my emails on my email client. Instead, I
store them on my personal Dovecot server on my desktop machine. Now I can switch email
clients every five minutes. I can switch them as a troubleshooting diagnostic test. No email
client will ever again own my data.
As an added benefit, my email filtering is done via Procmail, and my .procmailrc is in my
backed up home directory, not somewhere in /etc where it gets overwritten every time I
switch distros or even versions (I reinstall, I don't upgrade).

The following is an approximate diagram of my setup:

Purpose:
The IMAP protocol allows you to access your mail from any IMAP-compatible email client.
The major advantage over the POP3 protocol is the ability to view the same email from
multiple computers. This process will provide that benefit for providers that do not yet
support IMAP.
Requirements:
This process was originally written for Ubuntu Dapper 6.06, but has been updated for Ubuntu
Hardy 8.04. The IMAP server used is Dovecot, along with GetMail for retrieving the mail
from the POP3 servers.

Authentication:
By default Dovecot is set up to use system user authentication. If you're planning on using
system users, you can simply skip this section and read PAM (or bsdauth for configuring it.
If you're planning on using virtual users, it's easier to first create a simple passwd-like file to
make sure that the authentication will work. Later when you know Dovecot is working, you
can do it differently (see VirtualUsers).

Configuration of Dovecot:
When installing Dovecot and GetMail, it creates the following users and groups: dovecot and
mail. This is important because we will be using Dovecot's virtual users feature instead of
creating a new Linux user for each account you want to gather mail for. The "mail" user was
given a UID of 8 on the test machine, but yours may differ. You will need to UID number for
the "mail" user.
Installation:
The installation is extremely simple, just install the following packages:
1. dovecot-imapd
2. dovecot-pop3d

Overview:
Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems,
written with security primarily in mind. Dovecot is an excellent choice for both small and
large installations. It's fast, simple to set up, requires no special administration and it uses
very little memory.
Some of the most notable features of Dovecot include:

Dovecot is among the highest performing IMAP servers while still supporting
the standard mbox and Maildir formats. The mailboxes are transparently indexed, which
gives Dovecot its good performance while still providing full compatibility with existing
mailbox handling tools.

Dovecot is standards compliant. Dovecot v1.1 passes all IMAP server standard
compliancy tests while most other servers fail many of them.

Dovecot's indexes are self-optimizing. They contain exactly what the user's client
commonly needs, no more and no less.

Dovecot is self-healing. It tries to fix most of the problems it notices by itself, such as
broken index files. The problems are however logged so the administrator can later try to
figure out what caused them.

Dovecot tries to be admin-friendly. Common error messages are made as easily


understandable as possible. Any crash, no matter how it happened, is considered a bug that
will be fixed.

Dovecot allows mailboxes and their indexes to be modified by multiple computers at


the same time, while still performing well. This means that Dovecot works well with
clustered filesystems. NFS has caching problems, but you can work around them
with director proxies.

Dovecot's user authentication is extremely flexible and feature-rich, supporting many


different authentication databases and mechanisms.

Postfix 2.3+ and Exim 4.64+ users can do SMTP authentication directly against
Dovecot's authentication backend without having to configure it separately.

Dovecot supports easy migration from many existing IMAP and POP3 servers,
allowing the change to be transparent to existing users.

Dovecot supports workarounds for several bugs in IMAP and POP3 clients. Since the
workarounds may cause the protocol exchange to be suboptimal, you can enable only the
workarounds you need.

Dovecot's design and implementation is highly focused on security. Rather than


taking the traditional road of just fixing vulnerabilities whenever someone happens to report
them, I offer 1000 EUR of my own money to the first person to find a security hole from
Dovecot.

Dovecot is easily extensible. Plug-in can add new commands, modify existing
behavior, add their own data into index files or even add support for new mailbox formats.
For example quota and ACL support are completely implemented as plugins.

SquirrelMail:
SquirrelMail is a standards-based webmail package written in PHP. It includes built-in pure
PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0
(with no JavaScript required) for maximum compatibility across browsers. It has few
requirements and is easy to configure and install. SquirrelMail has all the functionality you
would want from an email client, including strong MIME support, address books, and folder
manipulation.
This manual supports SquirrelMail 1.4.0 and up. The 1.2.x series has been obsoleted, and is
only referenced in the upgrading notes of this manual.

Project origins:
The need arose in our organization for the access of email and address books from anywhere
in the world. Obviously a web interface is ideal for this, given that the user has access to the
Internet. After reviewing several open source projects they realized that they were going to

need to do some fairly major customizations to get things to be a nice fit for their needs. So
the decision was made to create their own for some of these reasons, and for fun (they really
like PHP). They decided to open source the project to contribute to the community that has
contributed so much to them.
Stability:
SquirrelMail is stable enough to use in a production system. It is, in fact, already used in
several production systems around the world, handling thousands of users per system. There
might be some bugs - no project is perfect - but they are most likely minimal. They test pretty
thoroughly before releasing a version marked as "stable".
License:
SquirrelMail is licensed under the GNU General Public License (GPL), so there are no
license fees to worry about.
Server requirements:
There are only two requirements for SquirrelMail:

A web server with PHP installed. PHP needs to be at least 4.1.0. PHP 4, PHP 5 and
PHP 6 are all supported.

Access to an IMAP server which supports IMAP 4 rev 1.

Choosing an IMAP server:


We don't actually have to run an IMAP server yourself, but we need to be able to connect to
one for SquirrelMail to work. Since IMAP is an open standard, all IMAP products should be
able to communicate with each other. SquirrelMail requires that the server supports IMAP 4
rev 1, but that's the only requirement there is.
Configuring PHP:

Without the PHP gettext extension you lose in performance.

The PHP mbstring extension is required for translations that use multibyte or
character sets but ISO-8859-1. Without the PHP mbstring extension the interface will
remain usable, but some internationalization features and fixes won't be enabled. It's a
must if you want to read and write Japanese emails, and users who whish to do that
must also set their language option to Japanese.

The PHP XML extension is required if the DIGEST-MD5 authentication is used.

Client requirements:

Cookies must be enabled in our browser. It might be hard to use SquirrelMail on a display
smaller than 15" and with less resolution than 1024 x 768, and some customizations are
required to make it usable.
Scalability:
SquirrelMail is known to scale well for large installations with thousands of users. It's
recommended to have a lot of free memory available at the web server. Another common
problem with larger systems is the connections per minute limitation. Suggested reading is
Optimizing SquirrelMail, SquirrelMail performance, and the speed section in the wiki.
An example of a large SquirrelMail installation (with peaks of 225 concurrent IMAP
connections) is described in the article HEC Montral: Deployment of a Large-Scale Mail
Installation from the May 2004 edition of Linux Journal.
SquirrelMail can be downloaded from the SquirrelMail website or provided by your OS
packager. It is configured with the conf.pl utility, that is stored in the config directory. You
must configure SquirrelMail before using it. SquirrelMail can be used by accessing it in web
browser just like any other files and scripts stored on your web server.
Directory layout:

Class directory stores various classes used with mime messages, email delivery,
localizations and other interface functions.

Config directory stores SquirrelMail configuration files and configuration utility.


conf.pl script is a perl based utility used to manage SquirrelMail configuration.

The contrib directory stores files that provide extra features to SquirrelMail package,
but are not used directly in the webmail interface.

The data directory is default location for SquirrelMail users' preference files.

The doc directory stores some documentation about SquirrelMail.

Functions directory stores SquirrelMail function files.

Under help are SquirrelMail help files. Information from these files is displayed when
a user clicks on Help link in SquirrelMail menu line. Help files use XML formating.
They can be translated into different languages.

User data storage:


SquirrelMail stores users' preferences and address books in simple text files. The location of
these files is set with the data directory setting in the SquirrelMail configuration. SquirrelMail
can also use a database or some other storage facility (if the required backend is provided by
a plugin) for managing user preferences.

Configuration utility:
SquirrelMail can be configured with conf.pl, a Perl script that is stored in the config/
directory. You can start it by running the configure script in the SquirrelMail base directory or
by running the conf.pl script in the config directory.
Main Menu -1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. Languages
D Set pre-defined settings for specific IMAP servers
C Turn color on
S Save data
Q Quit
Installing SquirrelMail:

In order to use SquirrelMail, we should take the following steps.

Download all required software

We can find the SquirrelMail package at the SquirrelMail site. PHP can be found at
the PHP site.

Install web server and PHP (version 4.1.0 or above).

SquirrelMail needs a web server with PHP support. Please refere to the PHP installation
manual for information about what web servers PHP works with and its installation
procedures.

Note that some Linux and Unix distributions provide a precompiled web server with PHP
support built in.
We recommend the following PHP settings:

Register global off - This is a dangerous setting when enabled, and is not generally
needed for most recent PHP applications. We no longer release security advisories for
issues only exploitable with this setting turned on because it has long been a wellknown weakness in PHP (and has been removed from PHP 6). We can easily enable it
only for a single legacy application that may require it while keeping the default off
for the rest of our applications.

Magic quotes {runtime, gpc, sybase} off - SquirrelMail may work with any of these
turned on, but if we experience stray backslashes in our mail or other strange
behavior, it may be advisable to turn them off.

File uploads on - This is needed if our users want to attach files to their emails.

Safe mode on or off - Turning safe mode on in SquirrelMail's case is not much more
secure than having it off. When it is enabled, incompatibilities with some
functionality may arise (see our safe mode notes).

Install IMAP server:

What IMAP server we can use depends on what the other components in our email
system are and how they were installed and configured. The IMAP server needs to
understand and be compatible with how messages are stored on our system.

If we use Unix or Linux with a standard send mail MTA server, we probably have to
install an IMAP server that works with mail stored in /var/spool/mail/, such as UW
IMAP, Dovecot, etc.

If we are running your email server on a Windows platform, we might have to enable
an IMAP service that is bundled with our email server.

If our email server does not support IMAP, we might have to find some other email
server product.

Unpack SquirrelMail package:

Unpack the SquirrelMail package in a web-accessible location.

Prepare data and attachment directories.

Select a data dirrectory and attachment dirrectory outside of the web server's reach
(for example in a Unix or Linux environment, a subdirectory of /var is a good place

for these).

Directory access considerations:


Only a small subset of the SquirrelMail source code needs to be directly accessible to users'
browsers. The rest of the source code is used internally by SquirrelMail. Leaving the entire
source tree open to outside access is not a problem or vulnerability, but some attackers have
been known to snoop for old versions of SquirrelMail by trying to inspect things such as the
ChangeLog file.
Configure SquirrelMail:
Run config/conf.pl (or just configure) from the command line. This is a Perl script, so if we
do not have Perl installed, please refer to our notes about how to configure SquirrelMail
without shell access.
Use the D option to load predefined settings for our particular IMAP server, and edit at least
the Server Settings and General Options (making sure to set the "Data Directory" and
"Attachment Directory" settings).

Installation:
SquirrelMail is installed by copying all of its files to the web server. We should be able to do
that with a FTP, SFTP or FTP-SSL client program.
Configuration:
We need to create a configuration file for SquirrelMail. If we have Perl on our own computer,
we can run the SquirrelMail configuration script (conf.pl, found in the config/ directory) on
our computer, using it to adjust our configuration, choose save when done, and then upload
the resultant config.php file to the web server.
Upgrading SquirrelMail:
Check requirements:
The system requirements may have been changed between our previous version and this
version of SquirrelMail. The requirements won't change (much) between stable releases but
may change significantly between different series (e.g. between 1.2.x and 1.4.x).
Also make sure to review the last section in this guide that details some issues that can arise if
we are upgrading to or from certain versions.

Configuration files

Plugins

Skins

Translations

Themes (if you've edited or added any of them)

Preferences (but only if you keep them inside the SquirrelMail directory)

Configuration files:
If at all possible, start the configuration process from scratch. This way, you are much less
prone to miss new configuration options or transfer any incompatible settings from one
version to the next. That said, when upgrading between minor versions.

$ cd /usr/share/
$ cp -p squirrelmail-1.4.8/config/config.php squirrelmail-1.4.17/config/
If you have a local configuration file, copy that too:
$ cp -p squirrelmail-1.4.8/config/config_local.php squirrelmail-1.4.17/config/

Run the configuration utility:


Although not strictly necessary for minor upgrades, we STRONGLY recommend that we run
config/conf.pl to see the new configuration options available with the new version, as well as
to verify that all of our old options are set properly.
How to point the web server to different SquirrelMail installations:
we assumed that your installation directories looked like "squirrelmail-1.4.17". Most of the
time, we'll want to allow our users to type in "squirrelmail" (or just "webmail" or "mail")
without needing to know the version number. Of course, we can simply change the name of
the SquirrelMail installation directory:

$ cd /usr/share/
$ mv squirrelmail-1.4.17 mail

Run the configuration utility:


Although not strictly necessary for minor upgrades, we STRONGLY recommend that we run
config/conf.pl to see the new configuration options available with the new version, as well as
to verify that all of our old options are set properly. In SquirrelMail versions 1.5.2 and above,
this also ensures that your plugins are properly registered with SquirrelMail.
Verify that the new installation works:
Log in and take a look around in our new installation and make sure everything is working as

expected.
Configuring SquirrelMail:
Even though the size of this documentation might indicate otherwise, SquirrelMail is quite
easy to configure. On the other hand, mailsystems are quite complicated for a beginner so a
few configuration tips might be useful.
Optimizing SquirrelMail:
Examining the whole chain:
SquirrelMail is far from a standalone product. The performance of a webmail system depends
on a lot of factors. It makes sense to look at each of these factors. You should think about the
following:

Web server. There's a lot of documentation about tuning Apache for example.

PHP. Using PHP as a module is a lot faster than the CGI version.

IMAP server. This starts with the choice of software. Different servers can have
radical performance differences.

Authentication backend. Some backends have slow responses. Caching solutions are
available.

Mail storage backend (mbox, maildir, database).


SquirrelMail itself.

PHP extensions:
We can install or enable some PHP extensions which will make SquirrelMail functionality
run faster. SquirrelMail uses gettext functions for translations. If PHP gettext extension is not
present, the interface switches to slower internal get text implementation.
Security:
This chapter should discuss some security aspects of our SquirrelMail installation.
Used terms:
TLS - Transport Layer Security:
Transport Layer Security is cryptographic protocol which provides secure communications
on the Internet. It is the successor to SSL v.3.0 protocol. The term "SSL" often applies to both
TLS and SSL protocols.
SSL - Secure Sockets Layer:

Secure Sockets Layer is cryptographic protocol which provides secure communications on


the Internet. Protocol runs on layers beneath application protocols such as HTTP, SMTP and
NNTP and above the TCP transport protocol, which forms part of the TCP/IP protocol suite.
SSL v.3.0 protocol is refined by Netscape Corporation. http://wp.netscape.com/eng/ssl3/
STARTTLS:

Available since SquirrelMail 1.5.1.

PHP 5.1.0rc1 or higher (stream_socket_enable_crypto() function)

Server with STARTTLS extension support

Changing passwords:
SquirrelMail doesn't store any passwords. It's the IMAP server's responsibility to take care of
that, and the IMAP server can choose from a number of different backends, such as SQL or
LDAP database for instance, to perform that task. Fortunately, there are several SquirrelMail
plugins that, depending on how your system is set up, can be used as a change password
interface.
Common PHP error messages:

unknown function session_id() call

missing session support

Safe mode

TODO: Clean the Safe mode section up.

Running SquirrelMail with PHP safe_mode restrictions.

Settings that are used in safe mode

UW IMAP:
Login Disabled:
uw-imapd server disables plain text logins by default in 2002 and newer versions. This was
done in order to follow security recommendations by IETF (The Internet Engineering Task
Force) and strict RFC 3501 security recommendations.
SquirrelMail uses plain text logins. In order to enable plain text logins, you will have to
recompile UW IMAP or use the semi-official /etc/c-client.cf configuration file.
See doc/imaprc.txt for further information. In order to enable plain text logins, we must add
Set disable-plaintext nil

You might also like