Postfix RPM Packages

http://postfix.wl0.org/

Important Packaging Changes

[cfields]adsleft[/cfields]Packages from version postfix-2.3.4-2 do NOT use the POSTFIX_IPV6 environment variable. This option is designed to be used on systems which do not have native IPv6 support and not to disable IPv6 functionality. The change was made at Wietse’s request. The rpm build procedures at least for Postfix 2.3 will now complain if the environment variable is set.

RPM Package Manager is a package management system. The name RPM variously refers to the .rpm file format, files in this format, software packaged in such files, and the package manager itself. RPM was intended primarily for GNU/Linux distributions; the file format is the baseline package format of the Linux Standard Base. Originally developed by Ethan “E$” Cohen at Red Hat for Red Hat Linux, RPM is now used by many GNU/Linux distributions. It has also been ported to some other operating systems, such as Novell NetWare (as of version 6.5 SP3) and IBM’s AIX as of version 4. Whereas an RPM typically contains the compiled version of the software, an SRPM contains either the source code corresponding to that RPM or the scripts of a non-compiled software package. Originally standing for “Red Hat Package Manager”, RPM now stands for “RPM Package Manager”, a recursive acronym.

Packages from version postfix-2.1.4-5 provide a new script to enable a new package to be built with one command, maintaining the installed package’s configured options. See below for details.

Packages from version postfix-2.0.13-4 do have the chroot disabled, whereas packages before this date did have the chroot enabled. A script, /etc/postfix/postfix-chroot.sh, has been provided to build a chroot and enable it, or to disable it and remove any chroot files. The Postfix author prefers Postfix packages to be provided in a similar way to the configuration which comes from building from source and this configuration does not enable chroot by default.

If you upgrade from a version before postfix-2.0.13-4 to this version or later, the previous chroot setting will be maintained.

General Packaging Information

The Postfix RPM I produce uses the following paths:

  • config files in /etc/postfix/
  • commands in /usr/sbin/
  • daemons in /usr/libexec/postfix/
  • newaliases and mailq in /usr/bin/
  • aliases file in /etc/postfix/
  • spool queue in /var/spool/postfix/
  • documentation in /usr/share/doc/postfix-<version>

The configuration file /etc/postfix/main.cf is the main configuration file used by postfix. It allows you to change almost all of postfix’s behaviour. Don’t change this file unless you know what you are doing, and most importantly if you do make any changes, verify each one before proceding with further changes.

This rpm requires a postfix user and group, used exclusively by Postfix, creating them if they don’t exist. It also requires a dedicated group postdrop again creating it if it doesn’t exist. Postfix is added to the group mail to facilitate communication with other mail software.

During installation and removal certain actions are logged via logger(1) to syslog. In a standard RedHat system this will be recorded in /var/log/maillog. The following command will extract relevant messages:

# grep postfix/rpm /var/log/maillog
Information Relating to different RedHat Releases

Red Hat Enterprise Linux

My packages should run on Red Hat Enterprise Linux releases 2 to 5 and clones such as WhiteboxLinux and CentOS. I try not to distinguish between RHEL and it’s clones so when I mention the Enterprise version assume I’m also talking about any of the RH clones.

Packages built under RedHat Enterprise Linux (and it’s clones) will have a .rhelX suffix, where X is the major version number.

Fedora Core

Fedora versions 1 to 8 are currently supported though I do not build binary rpms for all versions, due to insufficient resources.

Packages built under Core will have a .fcX suffix, where X is the version number.

Red Hat Linux 9:

Packages built under RedHat 9 will have a .rh9 suffix.

Red Hat Linux 8:

Packages for RedHat 8 by default use the db4 libraries. To build with db3 library support set POSTFIX_DB=3 before running make-postfix.spec and ensure that the db4-devel package is not installed.

Packages built under RedHat 8 will have a .rh8 suffix.

Red Hat Linux 7.x:

Packages for RedHat 7 by default use the db3 libraries. To build with db4 library support set POSTFIX_DB=4 before running make-postfix.spec and ensure that the db3-devel package is not installed.

Packages built on Red Hat 7.3 will not run on Red Hat 7.0-2.
Packages built on Red Hat 7.2 will not run on Red Hat 7.0 or 7.1.
This is due to the changes in the db3 libraries from one version of RH to the next.

There are separate packages for Red Hat 7.0 and 7.1, and these packages will run on Red Hat 7.2 IF the db31 “compatibility library” is installed.

Packages built under RedHat 7.3 with have a .rh73 suffix. Packages built under RedHat 7.2 will have a .rh72 suffix.
Packages built under RedHat 7.0 and 7.1 will have a suffix, and are only supported until postfix-2.0.x.

Red Hat Linux 6.x:

RPMs supported up until postfix-2.0.x.

Packages built under RedHat 6.x will have a .rh6 suffix.

Packages for RedHat 6 by default use the glibc db libraries. To build with db3 library support set POSTFIX_DB=3 before running make-postfix.spec.

Red Hat Linux 5.x:

The packages haven’t been tested on Red Hat 5.x. It may be possible to build them from source. Let me know.

IMPORTANT: If upgrading Red Hat Linux to a later major release, you may need to rebuild the various map files using postmap and postalias.
Information Relating to other Distributions

My RPMs have been known to run successfully on Mandrake and Yellowdog Linux. They may work on other RedHat-like RPM distributions. They probably won’t work with SuSE Linux as SuSE appears to use various distribution specific files which are different from RedHat’s. Please let me know if you successfully use my RPMs on a Linux distribution different to the ones mentioned above.

Building from Source

[cfields]adsright[/cfields]If you wish to use postfix with some of the additionally supported modules you will need to rebuild from the source package. You will also need to have installed the specific packages you wish to link against. During the build procedure rpm will tell you if you are missing the required packages, and likewise if you try and install a binary rpm and don’t have the required runtime libraries.

If you have downloaded the .src.rpm package and want to build the binary package follow the following steps:

  • Download source rpm package: postfix-.....src.rpm
  • Install the package which puts source files in %{_sourcedir} and %{_specdir}, ready for starting the package build. See below for the exact location that rpm uses.

    Note: This will not affect the binary packages that are currently installed on your machine.
    $ rpm -Uvh postfix-...src.rpm
    
  • According to the different distribution you are using, or the different options you wish to enable you may need to generate a new postfix.spec file. Create the specific postfix.spec file:
    $ cd `rpm --eval &#039;%{_sourcedir}&#039;`
    $ set the required build options
    export POSTFIX_SMTPD_MULTILINE_GREETING=1 # for exmaple
    $ export POSTFIX_IPV6=1 # This option is MUST NOT be set in postfix &gt; 2.3.4-2 and later.
    $ export POSTFIX_LDAP=1
    $ export POSTFIX_MYSQL=1
    $ export POSTFIX_MYSQL_REDHAT=1
    # # if used provide the directories of the mysql include and lib files
    # # - only 2 directories are allowed and the order should be as stated
    $ export POSTFIX_MYSQL_PATHS=/include/directory:/lib/directory
    $ export POSTFIX_PCRE=1
    $ export POSTFIX_PGSQL=1
    $ export POSTFIX_RBL_MAPS=1
    # There is support for building Postfix with SASL v1 or v2.
    # - select the correct version
    $ export POSTFIX_SASL=1	# to enable support for SASL v1
    $ export POSTFIX_SASL=2	# to enable support for SASL v2
    $ export POSTFIX_SPF=1  # this option was disabled in the first releases of postfix-2.3
    $ export POSTFIX_TLS=1
    $ export POSTFIX_VDA=1
    # DB library support is determined by default according to your distribution
    # however to modify the default library used you can do the following:
    $ export POSTFIX_DB=3 # to enable support for db3
    $ export POSTFIX_DB=4 # to enable support for db4
    # this creates %{_specdir}/postfix.spec
    $ sh `rpm --eval &#039;%{_sourcedir}&#039;`/make-postfix.spec
    
  • Build the binary rpms (locally):
    $ cd `rpm --eval &#039;%{_specdir}&#039;`
    $ rpmbuild -ba postfix.spec
    

    The binary and source rpms are put in %{_rpmdir}/i386 and %{_srcrpmdir} respectively.

  • Install the binary rpms:
    # rpm -Uvh `rpm --eval &#039;%{_rpmdir}&#039;`/i386/postfix-...i386.rpm
    

If you have any further questions regarding this package please let me know. Package building errors are mine alone, and not Wietse’s.

On RedHat Linux the standard directory structure used by rpm is:

RPM Macro					Standard Directory or Value
%{_sourcedir}			|	/usr/src/redhat/SOURCES
%{_specdir}				|	/usr/src/redhat/SPECS
%{_rpmdir}				|	/usr/src/redhat/RPMS

These values can be obtained from rpm by the following command:

# rpm --eval &#039;%{name}&#039;
A Word about Patches

My rpms provide for a large number of optional patches. Unfortunately some patches are incompatible. Where possible I will try (time and effort permitting) to ensure that different patches work together.

SPF patches are a notable example of this and I initially removed the SPF support in postfix-2.3. I have added it back again in postifx-2.3.4-3. Source rpms of the required SPF libraries can be found from http://www.libspf2.org/download.html (under redhat) or http://www.city-fan.org/ftp/contrib/libraries/. If built locally build with the following command line:

# rpmbuild -bb --without checks libspf2.spec

Thanks to  Eric Hoeve for his help in providing me the information on getting the patches to work.