squirrelmail, Cyrus and Postfix on RHEL 4

Many administrators would like to build a minimal fuss Webmail service that runs on top of their existing mail server. This article will explain how to go about setting up an email server on Red Hat Enterprise Linux 4 system using Postfix, Cyrus, Squirrelmail.

This article presents a cookbook style method of creating a webmail server that should also be able to be accessed using a standard IMAP mail client.

If you have an existing configuration, remove any existing RPMS for installation.

rpm -e cyrus-imapd
rpm -e cyrus-imapd-util
rpm -e cyrus-sasl-plain
You could also move any existing configuration files to /tmp so that you start with a clean slate.

mv /etc/cyrus* /tmp
mv /etc/squirrelmail/* /tmp
Install the necessary packages using the up2date command

up2date postfix cyrus-imapd cyrus-imapd-utils cyrus-sasl cyrus-sasl-plain httpd squirrelmail
Modify the /etc/imapd.conf file, and append the following options:

unixhierarchysep: yes
Make the relevant files and directories as specified in the default /etc/imapd.conf file.

su cyrus -c /usr/lib/cyrus-imapd/mkimap
Open the/etc/sysconfig/saslauthd file in your favourte editor and and change the value MECH to pam. Below is the /etc/sysconfig/saslauthd file from a working squirrilmail server.

# Directory in which to place saslauthd’s listening socket, pid file, and so
# on. This directory must already exist.
SOCKETDIR=/var/run/saslauthd
# Mechanism to use when checking passwords. Run “saslauthd -v” to get a list
# of which mechanism your installation was compiled to use.
MECH=pam

# Additional flags to pass to saslauthd on the command line. See saslauthd(8)
# for the list of accepted flags.
FLAGS=

Open the /etc/squirrelmail/config_local.php file in your favourte editor append the options below.

$imap_server_type = ‘cyrus’;
$optional_delimiter = ‘/’;
$default_folder_prefix = ‘’;
$trash_folder = ‘INBOX/Trash’;
$sent_folder = ‘INBOX/Sent’;
$draft_folder = ‘INBOX/Drafts’;

Configure the sasl authentication daemon to start on reboot.

# /sbin/chkconfig –level 345 saslauthd on
Start the sasl authentication daemon immediately, if saslauthd is not currently running it may fail to stop, this is expected.

# service saslauthd restart
Stopping saslauthd: [ OK ]
Starting saslauthd: [ OK ]
Configure the cyrus-imapd daemon to start on reboot.

# /sbin/chkconfig –level 345 cyrus-imapd on
Start the cyrus-imapd daemon immediately, if cyrus-imapd is not currently running it may fail to stop, this is expected.

# service cyrus-imapd start
Starting cyrus-imapd: preparing databases… done. [ OK ]
The cyrus mail server uses the user “cyrus” to administrate the cyrus mail server. This user should be automatically created when the cyrus IMAP server is installed. Set the password for the cyrus user as shown below.

passwd cyrus
The password for the cyrus user will be used to connect to the cyrus administration shell. The cyrus administration shell allows you to create and manage individual mailboxes for users.

You can connect to the cyrus administration shell with the command.

cyradm –user cyrus localhost
You will be asked for a password. Use the password that you had set for the cyrus user earlier.

IMAP Password:
localhost.localdomain>
The next step is to create a mailbox for a real user on your system.

localhost.localdomain> createmailbox user.joeuser
localhost.localdomain> listmailbox user.joeuser
user.joeuser (HasNoChildren)
localhost.localdomain> listaclmailbox user.joeuser
joeuser lrswipcda
localhost.localdomain> listquotaroot user.joeuser
Disable sendmail if it is already running.

# chkconfig sendmail off
# alternatives –config mta
There are 2 programs which provide ‘mta’.

Selection Command
———————————————–
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number:

Choose 2

Now we configure mailbox_transport in /etc/postfix/main.cf. Append the following line at the end of the /etc/postfix/main.cf



mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp
Add the postfix service to run on all multi-user runlevels with the command

# /sbin/chkconfig –level 345 cyrus-imapd on
Restart the postfix service

service postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
Finally, start the http daemon

service httpd restart
hutting down httpd: [ OK ]
Starting httpd: [ OK ]
Add it to the list of available services

# /sbin/chkconfig postfix on
Add it to the multi user runlevels.

# /sbin/chkconfig –level 345 postfix on
Visit http://yourservername.com/webmail in your web browser. You should be able to log in, and use the squirrilmail server as you would a standard imap server.

You should also be able to view the same mail from any mail client that supports IMAP.

from : http://blog.subverted.net/?p=513

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.