Install Postfix, Courier-IMAP on CentOS 5

Platform: CentOS 5.4 i386
Extra repositories used: utterramblings and rpmforge
You will end up with Postfix 2.6.5, Courier IMAP 4.6.0, authlib 0.62.4 and maildrop 2.2.0

First of all you will need to install gcc++:

yum install gcc-c++ redhat-rpm-config

Create a user to compile packages if you don’t have one already. I used rpmbuilder for the account name.

useradd -m -s /bin/bash rpmbuilder
passwd rpmbuilder

It will need some privileges so type visudo and add this line somewhere (I added it after root):

rpmbuilder ALL=(ALL) ALL

Create the directory structure:

su - rpmbuilder
mkdir $HOME/rpm
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/SPECS
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/RPMS/i386
echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros

Start downloading the needed courier packages(under the user rpmbuilder):

cd /tmp
wget http://sourceforge.net/projects/courier/files/maildrop/2.2.0/maildrop-2.2.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/imap/4.6.0/courier-imap-4.6.0.tar.bz2/download
wget http://sourceforge.net/projects/courier/files/authlib/0.62.4/courier-authlib-0.62.4.tar.bz2/download

These were the latest versions when I wrote the article, feel free to browse sourceforge and get what version you want.
Start building and installing the RPMs:

sudo rpmbuild -ta courier-authlib-0.62.4.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-authlib-0.62.4-1.i386.rpm courier-authlib-mysql-0.62.4-1.i386.rpm courier-authlib-devel-0.62.4-1.i386.rpm
cd /tmp
rpmbuild -ta courier-imap-4.6.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh courier-imap-4.6.0-1.i386.rpm
cd /tmp
sudo rpmbuild -ta maildrop-2.2.0.tar.bz2
cd $HOME/rpm/RPMS/i386
sudo rpm -ivh maildrop-2.2.0-1.i386.rpm

Done with Courier. Moving to postfix…

Download source RPM from this location:

cd /tmp
wget http://ftp.wl0.org/official/2.6/SRPMS/postfix-2.6.5-1.src.rpm
rpm -ivh postfix-2.6.5-1.src.rpm

I’ve made a few changes to the postfix.spec file (enabled mysql_redhat, vda patch) and also installed the required dependencies:

sudo yum install db4-devel mysql-shared mysql-devel

Building the postfix-2.6.5 rpm:

cd $HOME/rpm/SPECS
rpmbuild -ba postfix.spec

You should have the rpm in $HOME/rpm/BUILD so cd there and type:

sudo rpm -ivh postfix-2.6.5-1.rhel5.i386.rpm

In the end enable required services as root user:

chkconfig --levels 235 courier-authlib on
chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
chkconfig --levels 235 courier-imap on
service sendmail stop
service postfix start
service saslauthd start
service courier-authlib start
service courier-imap start

If everything went ok when telneting on port 25 of localhost you should get something similar to this:

Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 lightbringer.inno-solutions.ro ESMTP Postfix (2.6.5)
ehlo localhost
250-lightbringer.inno-solutions.ro
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

NOTE 1:
If you already have any of the packages install use rpm -Uvh instead of rpm -ivh.

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