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

Monday, September 21, 2009 posted by Till

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
wget http://mirror.rackspace.com/CentOS/5.3/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm
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

to:

%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

Be Sociable, Share!



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

  1. Liju says:

    This will not work

  2. Clemo says:

    I tried it and it worked for me too !

  3. Inny says:

    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

    Enjoy!

Leave a Reply