How to Install SquirrelMail on Unix and Linux systems
Any version numbers used in these examples are specific to the time when this documentation was written. You should generally use the most up to date versions of all software involved. That is, if there are newer versions of these packages available now, you’ll probably want to substitute the newer numbers in the examples below. Make sure that you are not using old, obsolete or vulnerable software!
This guide uses the UW IMAP server, because it is a simple (and ubiquitous) example and because it can be used in most generic email system setups where incoming mail is stored in the
/var/spool/mail directory. If you are planning to offer webmail on a system with a large number of users or where users have large mailboxes, consider planning a better email system design and using different IMAP server software.
PLEASE NOTE that before you begin installing such things as a web server, PHP or an IMAP server, you should check whether or not your system already has such software installed. Many server-class systems come with that kind of software ready to go. Also note that these installation instructions use generic compilation commands that should work on most any system, however your system may have more graceful (and even easier) ways to install software, like the
apt-get tool in systems such as Debian and the
yum tool in systems such as Fedora/Red Hat.
Typically, you’ll need to have root-level access to your server to perform these operations.
Download required software
You will need:
- Apache – http://httpd.apache.org/download.cgi
- PHP – http://php.net/downloads.php
- UW IMAP – http://www.washington.edu/imap/
- SquirrelMail – http://squirrelmail.org/download.php
# install -d /usr/local/src/downloads # cd /usr/local/src/downloads # wget http://some-apache-mirror-server/apache/httpd/httpd-2.2.11.tar.gz # wget http://www.php.net/get/php-5.2.9.tar.bz2/from/a/mirror # wget ftp://ftp.cac.washington.edu/mail/imap.tar.Z # wget http://some-sourceforge-mirror/some-path/squirrelmail-1.4.17.tar.bz2
Unpack and install Apache
# cd /usr/local/src # tar -xzvf /usr/local/src/downloads/httpd-2.2.11.tar.gz # cd httpd-2.2.11 # ./configure --prefix=/usr/local/apache --enable-module=so # make # make install
Unpack and install PHP
# cd /usr/local/src # tar --bzip2 -xvf /usr/local/src/downloads/php-5.2.9.tar.bz2 # cd php-5.2.9 # ./configure --prefix=/usr/local/php \ > --with-apxs2=/usr/local/apache/bin/apxs # make # make install
Note that if you decide to configure your PHP compilation with the
--disable-all option, you must also add the
Add PHP support to Apache
In your main Apache configuration file (typically
/etc/httpd/conf/httpd.conf), add this:
<IfModule mod_php5.c> AddType application/x-httpd-php .php </IfModule>
Restart Apache and check if PHP is working
Execute the restart request from the command line:
# /usr/local/apache/bin/apachectl graceful
Create a test file in the document root of Apache and put this in it:
<?php phpinfo(); ?>
Load that file in a web browser and make sure it displays a page describing your PHP system details.
Unpack and install IMAP server
Unpack the UW IMAP package.
# cd /usr/local/src # tar -xzvf /usr/local/src/downloads/imap.tar.Z
Compile UW IMAP:
# cd /usr/local/src/imap-<some version> # make port-name EXTRADRIVERS='' SSLTYPE=unix
port-name” above with the name that matches your system. Check the file “
Makefile” for possible values. If you haven’t installed OpenSSL libraries and headers, use “
SSLTYPE=none” instead of “
Install IMAP server binary:
# strip imapd/imapd # install -d /usr/local/libexec/ # cp imapd/imapd /usr/local/libexec/
Enable IMAP server in
imap2 stream tcp nowait root /usr/sbin/tcpd /usr/local/libexec/imapd
Now, restart inetd.
Prepare SquirrelMail directories
Make sure to change “nogroup” to whatever group Apache will be running as. You can check what that is by looking at the value of the “Group” setting in your Apache main configuration file (probably
# mkdir /usr/local/squirrelmail # cd /usr/local/squirrelmail # mkdir data temp # chgrp nogroup data temp # chmod 0730 data temp
# cd /usr/local/squirrelmail # tar --bzip2 -xvf /usr/local/src/downloads/squirrelmail-1.4.17.tar.bz2 # mv squirrelmail-1.4.17 www
Run the SquirrelMail configuration utility.
# cd /usr/local/squirrelmail # www/configure
This is a Perl script, so if you do not have Perl installed, please refer to our notes about how to configure SquirrelMail without shell access.
Select the “D” option and then configure SquirrelMail with the “uw” preset. Also make sure to set the data and attachment directory settings (“
/usr/local/squirrelmail/data” and “
/usr/local/squirrelmail/temp” respectively) under “
4. General Options“. Make any other changes as you see fit, select “S” to save and then “Q” to quit.
Modify your main Apache configuration file (typically
/etc/httpd/conf/httpd.conf) by adding the following:
Alias /squirrelmail /usr/local/squirrelmail/www <Directory /usr/local/squirrelmail/www> Options None AllowOverride None DirectoryIndex index.php Order Allow,Deny Allow from all </Directory> <Directory /usr/local/squirrelmail/www/*> Deny from all </Directory> <Directory /usr/local/squirrelmail/www/images> Allow from all </Directory> <Directory /usr/local/squirrelmail/www/plugins> Allow from all </Directory> <Directory /usr/local/squirrelmail/www/src> Allow from all </Directory> <Directory /usr/local/squirrelmail/www/templates> Allow from all </Directory> <Directory /usr/local/squirrelmail/www/themes> Allow from all </Directory> <Directory /usr/local/squirrelmail/www/contrib> Order Deny,Allow Deny from All Allow from 127 Allow from 10 Allow from 192 </Directory> <Directory /usr/local/squirrelmail/www/doc> Order Deny,Allow Deny from All Allow from 127 Allow from 10 Allow from 192 </Directory>
Now restart Apache from the command line:
# /usr/local/apache/bin/apachectl graceful
Log into SquirrelMail
Now you should be able to access SquirrelMail by going to
For More Details Visit http://www.squirrelmail.org/docs/admin/admin-3.html