All HowTo's Linux Redhat, Fedora and CentOS Linux Ubuntu, Mint & Debian Linux

Install Postfix, Dovecot & Squirrelmail

This article demonstrates how to install Postfix, Dovecot and Squirrelmail on Redhat/CentOS Linux.

yum install dovecot postfix httpd php mod_ssl openssl

Set things to start on boot:

chkconfig postfix on
chkconfig dovecot on
chkconfig httpd on

Make sure to permit ports 25, 80 and 443 through the firewall(s).

Edit the “/etc/postfix/main.cf” file and make these changes:

myhostname = mail.example.com
mydomain = example.com
myorigin = $myhostname
inet_interfaces = all
#inet_interface = localhost
mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost
mynetworks = 192.168.0.0/16, 127.0.0.0/8

Edit the “/etc/dovecot/conf.d/10-mail.conf” file and make this change:

mail_location = mbox:~/mail:INBOX=/var/spool/mail/%u

Install Squirrelmail:

cd /tmp
wget http://downloads.sourceforge.net/project/squirrelmail/stable/1.4.22/squirrelmail-webmail-1.4.22.zip
unzip squirrelmail-webmail-1.4.22.zip
cd squirrelmail-webmail-1.4.22
./configure

At this stage you should follow the on-screen prompts to complete the Squirrelmail installation.
Now copy your Squirrelmail structure into the web server document root:

cp -rp /tmp/squirrelmail-webmail-1.4.22/* /var/www/html

Edit your “/etc/httpd/conf.d/ssl.conf” file accordingly:

DocumentRoot "/var/www/html/"
ServerName www.example.com:443

Consider setting a valid certificate for the HTTPS access to your web mail site.

Restart these services and do some testing. Monitor your “/var/log/maillog” for errors. Such as “tail -f /var/log/maillog”. Good luck.

service httpd restart
service dovecot restart
service postfix restart

Bug fix. If you get permission errors in the logs and can’t see new email, try this:

Error: chown(/home/myuser/mail/.imap/INBOX, -1, 12(mail)) failed: Operation not permitted (egid=1367(myuser), group based on /var/spool/mail/myuser)
Feb  5 07:36:42 dc dovecot: imap(myuser): Error: mkdir(/home/myuser/mail/.imap/INBOX) failed: Operation not permitted

This is to do with group ownership and permissions. There is a better way to resolve this than i’ve shown below and i will update this article shortly. However, it can be quickly solved with this:

chmod 0600 /var/spool/mail/*

Leave a Reply

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