Install postfix with MySQL support on CentOS 5.3 (64Bit)

The following article explains the steps to compile postfix MTA with MySQL support on CentOS 5.3 as e.g. needed for ISPConfig 3.

Remove the postfix package from CentOS which does not has MySQL support:

/etc/init.d/postfix stop
rpm -e --nodeps postfix

Download the postfix source RPM and install it:

cd /tmp
rpm -i postfix-2.3.3-2.1.el5_2.src.rpm

Edit the spec file to enable MySQL support.

vi /usr/src/redhat/SPECS/postfix.spec

and change the line:

%define MYSQL 0


%define MYSQL 1

Install a few prerequisites before we build the new postfix RPM package

yum install pcre-devel mysql-devel

Build the postfix RPM with MySQL support:

rpmbuild -ba /usr/src/redhat/SPECS/postfix.spec

and install it.

cd /usr/src/redhat/RPMS/x86_64
rpm -i postfix-2.3.3-2.1.x86_64.rpm

Start postfix and configure it to be started at boot time:

/etc/init.d/postfix start
chkconfig --levels 235 postfix on

4 thoughts on “Install postfix with MySQL support on CentOS 5.3 (64Bit)”

    • Avatar

      Have you tried it? For me it worked.

  1. Avatar

    I tried it and it worked for me too !

  2. Avatar

    For CentOS/RHEL, at step 3, when editting /usr/src/redhat/SPECS/postfix.spec , have it read:

    %define with_mysql 0
    %define with_mysql_redhat 1

    To overcome errors when installing the RPM:

    error: Failed build dependencies:
    MySQL-shared is needed by postfix-2.7.2-1.rhel5.x86_64
    MySQL-devel is needed by postfix-2.7.2-1.rhel5.x86_64



Leave a Comment