Note: The following is part of a series of steps to setup an email server using Exim 4.x, with imap and webmail access. It will use winbind to get user information from an NT server. If you found this page via a search engine it may not cover what you need or you may need to start at the beginning to understand everything I have done.
(Note: These instructions reference software that is now possibly much newer with many new or different configuration options. This page is being left up for reference.)
See http://www.squirrelmail.org/ for much more information.
Quick steps:
- Download and unpack
- Create attachments directory
- Set permissions and owner
- Install perl if it is not (or see the Squirrelmail website for manually editing the config)
- Run the configuration script
- Check php.ini
- Check that DirectoryIndex has index.php added in httpd.conf
- Test
- Rename directory as desired
- Add plugins as desired
- Upgrading
- Miscellaneous
Note I am using Red Hat 8.0. I am not using the squirrelmail-*.rpm that comes with Red Hat because it wants sendmail installed (which you could use the --nodeps option). Since this just needs to be unpacked, I really see no need for an rpm anyway. I assume you have apache at least minimally configured.
Get the tar.gz from here: http://www.squirrelmail.org/
Move it to the "DocumentRoot" location specified in the apache config ( see /etc/httpd/conf/httpd.conf). Default is /var/www/html/.
Unpack:
tar -xvzf name.tar.gz
Don't forget to remove the tar file (rm *.tar)
Change the user and group for the directory:
chown -R root.apache squirrelmail-version
2) Create attachments directory
cd into the squirrelmail directory created. Make the attachments directory:
mkdir attachments
The user the web server runs as must have right to data and attachments. If you use the Red Hat httpd-*.rpm the default is apache for both user and group.
chown -R apache.apache data attachments
chmod -R 1770 data attachments
4) Install perl if it is not (or see the Squirrelmail website for manually editing the config)
Should be self explanatory.
5) Run the configuration script
cd into the config directory. To configure, type:
perl conf.pl
At minimum you need to change:
- Menu 2 - Server Settings
- Domain: your.domain
- Use Sendmail/SMTP: SMTP (I'm using Exim 4.x)
- Server (in IMAP Settings): xxx
(I've tested both uw and courier, and for a bit, exchange)
- Menu 4 - General Options
- Attachment Directory: ../attachments/
The rest is up to you. Don't forget to save before you exit.
Note: In order to clean up the way some imap clients present the user's mailbox I have changed:
- Menu 3 - Folder Defaults
- 1. Default Folder Prefix: INBOX. (for Courier or mail/ for UW)
- 3. Trash Folder: Trash
- 4. Sent Folder: Sent
- 5. Drafts Folder: Drafts
- 12. Default Sub. of INBOX : true (for courier)
- 13. Show 'Contain Sub.' Option: true (for uw)
In regaurds to shared folders, for UW-IMAP see #11 in Setting up UW-IMAP on how to make public folders appear. For Courier-IMAP I use:
-
- 1. Default Folder Prefix: (none)
- 2. Show Folder Prefix Option : false
- 3. Trash Folder : INBOX.Trash
- 4. Sent Folder : INBOX.Sent
- 5. Drafts Folder : INBOX.Drafts
- 12. Default Sub. of INBOX : true
With pre-1.2.9 I had to set register_globals = On. This file should be in /etc.
With 1.2.9 and later I was able to turn register_globals=Off.
7) Check that DirectoryIndex has index.php added in httpd.conf
This will be in /etc/httpd/conf
Point your web browser at:
http://server_name_or_ip/squirrelmail_dir/
If the squirrelmail page loads, try to login. If you can't login, check that imap is enabled in xinetd.d/imap if using uw-imap (tip: restart xinetd) or courier is started and that you can use an email client to login.
If you see code, php isn't working or isn't installed. If you see files, check step 7. See the squirrelmail, apache, and php web sites for more troubleshooting and configuration tips.
9) Rename directory as desired
Once you have the basics working you can rename the squirrelmail directory that was created. By waiting until this point you can effectively test before replacing any existing installation. To rename it cd back to the DocumentRoot (ie /var/www/html) so that you can see the squirrelmail directory. Now issue:
mv oldname newname
Of course replace "oldname" and "newname" with the correct entries.
There is lots of stuff out there for Squirrelmail. It comes with a few and there are
more at the web site. I'm using:
delete_move_next
newmail
squirrelspell
message_details
msg_flags
folder_sizes
secure_login
compatibility
newuser_wiz
filters (with the spam rbl filtering turned off in it's setup.php file)
vacation_exim (plugin I wrote to work with Exim's autoreply transport and .forward files)
To install what you download, place them in (DocumentRoot)/(squirrelmail dir)/plugins. Next, unpack them:
gunzip name.tar.gz
tar -xvf name.tar
You can now remove the tar files if you like (rm *.tar).
Enter the directory created for the plugin and read the README and/or INSTALL file. Some plugins require you to configure some things in one of their files.
Then re-run the config.pl, see step 5, and add them to the list by typing in the number. To remove, reverse the process. Note that you will not see some of what you installed on the web page until you enable it through Options, such as for folder_sizes.
- Download and extract the new version of Squirrelmail.
- cp old_dir/config/config.php new_dir/config/
- cp old_dir/data/* new_dir/data/
- cd new_dir
mkdir attachments
chown -R apache.apache data attachments
chmod -R 1770 data attachments - Check for new versions of plugins. Use new versions if available, else:
cp old_dir/plugins/plugin_to_keep new_dir/plugins/
If using new, remember to configure them where applicable.
If using the msg_flags plugin, remember to modify the Squirrelmail files it requires changed. - Make the same changes to any files you customized in the old version.
- Run perl conf.pl in new_dir/config/. Review all settings to make sure they are correct and nothing has changed.
- Point your browser to the new_dir to make sure everything works.
- Fix anything that is broken and test again.
- mv old_dir backup_name
mv new_dir old_dir_name
- To get Squirrelmail -> Compose -> Addresses to search your LDAP address book in company as well as name, edit functions/abook_ldap_server.php. Change:
$expression = "cn=$expr";
to:
$expression = "(|(cn=$expr)(o=$expr))";