3.2. Postfix compiled with dovecot SASL and virtual users support

If you want a 100%-according-to-your-needs package, the solution is to recompile postfix from source using a modified .spec file.
Before compiling the postfix package to support SASL, MySQL lookup tables and virtual users, some development tools must be installed.

Development tools installation

# yum install gcc rpm-build

and dependencies:

Postfix build dependencies installation

# yum install db4-devel zlib-devel
# yum install openldap-devel pcre-devel
# yum install mysql-devel openssl-devel

First, the postfix source must be downloaded. Since I prefer keeping CentOS package versions, I've used the postfix source RPM, available at CentOS mirrors, in the directory ./os/SRPMS/. You must also download the VDA patch from http://vda.sourceforge.net, to enable virtual delivery agent for postfix, it is required for virtual users support.

postfix sources and patches download

# cd /var/tmp
# wget ftp://ftp.iasi.roedu.net//pub/mirrors/centos.org/5.3/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm
# rpm --install -vh postfix-2.3.3-2.1.el5_2.src.rpm
# cd /usr/src/redhat/SOURCES
# wget
# gunzip

Modify /usr/src/redhat/SPECS/postfix.spec file to enable SASL and MySQL (and/or Postgresql if required). The main differences are: Cyrus-SASL support removed, MySQL support added, set default SASL to "dovecot", postfix-vda patch included. Use the postfix.spec.diff attached below, upload it to /usr/src/redhat/SOURCES, and apply the patch:

Apply postfix customizations

# cd /usr/src/redhat/SOURCES
# patch -p0 < postfix.spec.diff

Now you are ready to build the package:

Postfix package build

# rpmbuild -bb /usr/src/redhat/SPECS/postfix.spec
# rpmbuild -bs /usr/src/redhat/SPECS/postfix.spec
The first command builds a .rpm package, you'll find it on /usr/src/redhat/RPMS/architecture/postfix-2.3.3-2.1.i386.rpm
The second command builds a .src.rpm package, you'll find it on /usr/src/redhat/SRPMS/postfix-2.3.3-2.1.src.rpm, it contains all the modified and added files (VDA patch, the modified postfix.spec file), you may need it later.

Now you can install the package:

Postfix package installation

# rpm --install -vh /usr/src/redhat/RPMS/i386/postfix-2.3.3-2.1.i386.rpm

After installing the package, probably you should add it to [base] and [updates] sections 'excludepkgs' list in /etc/yum-repos.d/CentOS-Base.repo, so an upgrade won't mess your system.

Up: Postfix installation and configuration
Prev: Postfix compiled with dovecot SASL and virtual users support
Emil Cazamir,
Oct 19, 2009, 11:04 AM