One problem that can comes up with the fantastic Centos Linux distro is that it sticks to the proven but also old packages. I needed some newer features several times. One of the (good) ways to deploy Postfix 3 on Centos is to do an upgrade from source.
First, we need the link to the newest package (take a look here). In my case, it’s 2.11 stable, so let’s download it:
cd wget http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-3.3.1.tar.gz tar xf postfix-3.3.1.tar.gz cd postfix-3.3.1
Now we need to isntall the development packages and the dependencies. These are the packages that I needed but You might need to install more, depending on which features You want to compile into it. For a standard featured Postfix MTA with SASL and MySQL support you’ll need the following:
yum install libdb-devel db4-devel cyrus-sasl cyrus-sasl-devel openssl openssl-devel pcre pcre-devel openldap openldap-devel mysql-devel
Let’s celan up the makefiles now, and build new ones (because by the supplied makefile Postfix won’t be compiled with SASL and SQL support), and at the end let’s build the whole package:
make clean make tidy make makefiles CCARGS='-fPIC -DUSE_TLS -DUSE_SSL -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DPREFIX=\\"/usr\\" -DHAS_LDAP -DLDAP_DEPRECATED=1 -DHAS_PCRE -I/usr/include/openssl -DHAS_MYSQL -I/usr/include/mysql -I/usr/include/sasl -I/usr/include' AUXLIBS='-L/usr/lib64 -L/usr/lib64/openssl -lssl -lcrypto -L/usr/lib64/mysql -lmysqlclient -L/usr/lib64/sasl2 -lsasl2 -lpcre -lz -lm -lldap -llber -Wl,-rpath,/usr/lib64/openssl -pie -Wl,-z,relro' OPT='-O' DEBUG='-g' make
The last step (build) will take a while, depeding on the CPU power of Your Linux box. At this moment, if it maneges to build without errors, you’ll have a ready to upgrade package. If not, you will need to yum groupinstall “Development Tools” and retry.
Regarding the arguments about building the makefile (step 3 above), depending on the features You want built in the new Postfix package please refer to the chapter 4.4 of the Postfix documentation. Basically, I never needed anything more than this, except that sometimes I want to use PgSQL instead of MySQL, then you will need to yum install postgresql-devel package and insert the correct arguments when creating the makefile.
One more note: creating the makefile in this example is done for Centos x64. If you are building for the 32-bit verion you will have to replace all the /usr/lib64 arguments with /usr/lib.
If everything is errorless, perform the upgrade to Postfix 3:
Done. Please also read the suggested articles during install about the new features, and sugested changes to the master.cf and main.cf files.
Regarding the package, since You done it by compiling from the source, the RPM package will stay at version 2.6.x but when you finally do a service postfix restart you will see:
Sep 12 11:55:51 atreides postfix/postfix-script: starting the Postfix mail system
Sep 12 11:55:51 atreides postfix/master: daemon started — version 3.3.1, configuration /etc/postfix