By default, Postfix in RHEL does not support MySQL.
The Postfix needs to be re-compiled, but the Postfix is linked with other software, so I decided to use the SRC of the Postfix provided by RHEL to solve some problems after installing the source code. re-create an RPM package that supports MySQL.
1. First download and install the Postfix SRC. RPM package
[Root @ mail ~] # Cd/usr/local/src <br/> [root @ mail SRC] wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/ OS /SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm <br/> [root @ mail SRC] mkdir-P/usr/src/RedHat/ sources <br/> [root @ mail SRC] rpm-ihv postfix-2.3.3-2.src.rpm
2. Download and decompress the same VDA patch package as the SRC. RPM Main version.
[Root @ mail SRC] cd/usr/src/RedHat/sources <br/> [root @ mail sources] wget http://vda.sourceforge.net/VDA/postfix-2.3.3-vda.patch.gz <br/> [root @ mail sources] gunzip postfix-2.3.3-vda.patch.gz
3. Modify the Postfix. spec file to add MySQL support
[Root @ mail sources] cd/usr/src/RedHat/specs <br/> [root @ mail specs] CP Postfix. spec postfix.spec.org <br/> [root @ mail specs] vi Postfix. spec <br/> % define MySQL 0 <br/> changed to <br/> % define MySQL 1 <br/> appended to the # patches segment <br/> patch11: postfix-2.3.3-vda.patch <br/> append after # apply obligatory patches <br/> % patch11-P1-B. VDA
4. Use rpmbuild to generate an RPM package. This part may depend on some Development kits and you can directly install yum.
[Root @ mail specs] rpmbuild-Ba Postfix. spec <br/> found lack of db4-devel openldap-devel cyrus-sasl-devel PCRE-devel package <br/> [root @ mail specs] Yum-y install db4-devel openldap-devel Cyrus- SASL-devel PCRE-devel <br/> [root @ mail specs] rpmbuild-Ba Postfix. spec <br/> This location takes a little longer, the RPM package is under/usr/src/RedHat/RPMS/i386/. <br/> [root @ mail specs] ls/usr/src/RedHat/RPMS/i386/ <br/> postfix-2.3.3-2.1.i386.rpm postfix-pflogsumm-2.3.3-2.1.i386.rpm
5. the RPM package is successfully generated. Install the RPM package and check whether MySQL is supported.
Note: In this step, if your system already has a postfix, and the dependency cannot be uninstalled first, add the -- force parameter during installation to force the replacement.
[Root @ mail specs] rpm-UHV/usr/src/RedHat/RPMS/i386/postfix-2.3.3-2.1.i386.rpm <br/> [root @ mail specs] postconf-M <br/> btree <br/> CIDR <br/> environ <br/> hash <br/> ldap <br/> mysql <br/> NiS <br/> PCRE <br/> proxy <br/> Regexp <br/> static <br/> Unix
You can see that MySQL is supported, and O (∩ _ ∩) O Haha ~!
6. because we have installed our own RPM package, you cannot use Yum to update the Postfix. Otherwise, MySQL is not supported after the new version is replaced with our version, therefore, we will not allow the Postfix to be updated from yum.
[Root @ mail specs] CP/etc/yum. conf/etc/yum.conf.org <br/> [root @ mail specs] vi/etc/yum. conf <br/> append a sentence <br/> exclude = Postfix *
In this way, if a new version of Postfix is available during Yum update, the update will not be performed by default, but we will be prompted. We can download the new SRC. RPM package and create a new RPM package in the same way.
Digress:
While doing this, we found that the centos centosplus source already provides Postfix packages that support MySQL and pgsql.
(You can configure the yum source and then directly install yum, details http://wiki.centos.org/AdditionalResources/Repositories/CentOSPlus)
You can also download it at http://ftp.heanet.ie/pub/centos/5/centosplus/ I #/rpms ).