Introduction to Postfix

The Postfix package contains a Mail Transport Agent (MTA). This is useful for sending email to other users of your host machine. It can also be configured to be a central mail server for your domain, a mail relay agent or simply a mail delivery agent to your local Internet Service Provider (ISP).

Package Information

Postfix Dependencies


PCRE-6.7, MySQL-5.0.21, PostgreSQL-8.1.3, OpenLDAP-2.3.27, OpenSSL-0.9.8d, Cyrus SASL-2.1.21, and cdb or TinyCDB

User Notes:

Installation of Postfix

Configuring the Build

The Postfix source tree does not contain a configure script, rather the makefile in the top-level directory contains a makefiles target that regenerates all the other makefiles in the build tree. If you wish to use additional software such as a database back-end for virtual users, or TLS/SSL authentication, you will need to regenerate the makefiles using one or more of the appropriate CCARGS and AUXLIBS settings listed below.

Here is an example that combines the TLS and Cyrus-SASL arguments:

make makefiles \
    -DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
    -DDEF_MANPAGE_DIR=\"/usr/share/man\" \
    -DDEF_HTML_DIR=\"/usr/share/doc/postfix-2.3.3/html\" \
    -DDEF_README_DIR=\"/usr/share/doc/postfix-2.3.3/README\" \
    -I/usr/include/openssl -I/usr/include/sasl' \
    AUXLIBS='-L/usr/lib -lssl -lcrypto -lsasl2'
TLS Authentication

To use TLS authentication with postfix you will need to pass the following values to the make makefiles command:

CCARGS='-DUSE_TLS -I/usr/include/openssl'
AUXLIBS='-L/usr/lib -lssl -lcrypto'

To use TLS you will also need Cyrus SASL-2.1.21.


To use Cyrus-SASL with Postfix, use the following arguments:

AUXLIBS='-L/usr/lib -lsasl2'

To use OpenLDAP with Postfix, use the following arguments:

CCARGS='-I/usr/include -DHAS_LDAP'
AUXLIBS='-L/usr/lib -lldap -llber'

To use MySQL with Postfix, use the following arguments:

CCARGS='-DHAS_MYSQL -I/usr/include/mysql'
AUXLIBS='-L/usr/lib -lmysqlclient -lz -lm'

To use PostgreSQL with Postfix, use the following arguments:

CCARGS='-DHAS_PGSQL -I/usr/include/postgresql'
AUXLIBS='-L/usr/lib -lpq -lz -lm'

To use TinyCDB with Postfix, use the following arguments:


Installing Postfix

Before you compile the program, you need to create users and groups that will be expected to be in place during the installation. Add the users and groups with the following commands issued by the root user:

groupadd -g 32 postfix &&
groupadd -g 33 postdrop &&
useradd -c "Postfix Daemon User" -d /dev/null -g postfix \
    -s /bin/false -u 32 postfix &&
chown -v postfix:postfix /var/mail

Install Postfix by running the following commands:

make makefiles \
CCARGS='-DDEF_DAEMON_DIR=\"/usr/lib/postfix\" \
    -DDEF_MANPAGE_DIR=\"/usr/share/man\" \
    -DDEF_HTML_DIR=\"/usr/share/doc/postfix-2.3.3/html\" \
    -DDEF_README_DIR=\"/usr/share/doc/postfix-2.3.3/README\" \
    <additional args>' \
    <AUXLIBS='additional args'> &&

This package does not come with a test suite.

Now, as the root user:

sh postfix-install -non-interactive

Command Explanations

make makefiles: This command rebuilds the makefiles throughout the source tree to use the options contained in the CCARGS and AUXLIBS variables.

sh postfix-install -non-interactive: This keeps the install script from asking any questions, thereby accepting default destination directories in all but the few cases mentioned in the 'make makefiles' command.

Configuring Postfix

Config Files

/etc/aliases, /etc/postfix/, and /etc/postfix/

Configuration Information

cat >> /etc/aliases << "EOF"
# Begin /etc/aliases

MAILER-DAEMON:    postmaster
postmaster:       root

root:             LOGIN
# End /etc/aliases


To protect an existing /etc/aliases file, the above command appends these aliases to it if it exists. This file should be checked and duplicate aliases removed, if present.

The /etc/aliases file that was just created or appended, the and the must be personalized for your system. The aliases file needs your non-root login identity so mail addressed to root can be forwarded to you at the user level. The file needs your fully qualified hostname. All of these edits can be done with sed commands entered into the console with appropriate substitutions of your non-root login name for <user> and your fully qualified hostname for <localhost.localdomain>. You will find the file is self documenting, so load it into your editor to make the changes you need for your situation.

sed -i "s/LOGIN/<user>/" /etc/aliases &&
sed -i "s/#myhostname = host.domain.tld/myhostname = \
  <localhost.localdomain>/" /etc/postfix/ &&

If you have an existing configuration, you can run the postfix utility to add any necessary definitions to your existing files. As the root user:

/usr/sbin/postfix upgrade-configuration

Before starting Postfix, you should check that your configuration and file permissions will work properly. Run the following commands as the root user to check and start your Postfix server:

/usr/sbin/postfix check &&
/usr/sbin/postfix start

Boot Script

To automate the running of Postfix at startup, install the /etc/rc.d/init.d/postfix init script included in the blfs-bootscripts-20060910 package.

make install-postfix


Installed Programs: anvil, bounce, cleanup, discard, error, flush, lmtp, local, mailq, master, newaliases, nqmgr, oqmgr, pickup, pipe, postalias, postcat, postconf, postdrop, postfix, postkick, postlock, postlog, postmap, postqueue, postsuper, proxymap, qmgr, qmqpd, sendmail, showq, smtp, smtpd, spawn, tlsmgr, trivial-rewrite, verify, and virtual
Installed Libraries: None
Installed Directories: /etc/postfix, /usr/lib/postfix and /usr/share/doc/postfix-2.3.3

Short Descriptions


Provides connection and rate request limiting.


A daemon that maintains per-message log files with non-delivery status information.


A daemon that processes inbound mail, inserts it into the incoming mail queue, and informs the queue manager of its arrival.


Processes delivery requests from the queue manager that cannot be delivered to the recipient.


A daemon that processes non-delivery requests from the queue manager.


A daemon that maintains a record of deferred mail by destination.


A daemon that processes message delivery requests from the queue manager.


A daemon that processes delivery requests from the queue manager to deliver mail to local recipients.


A symlink to sendmail.


The resident process that runs Postfix daemons on demand.


A symlink to sendmail.


A daemon that awaits the arrival of incoming mail and arranges for its delivery.


The old style queue manager. This will be removed soon.


A daemon that waits for hints that new mail has been dropped into the maildrop directory, and feeds it into the cleanup daemon.


A daemon that processes requests from the queue manager to deliver messages to external commands.


Creates or queries one or more Postfix alias databases, or updates an existing one.


Prints the contents of the named files in human readable format.


Displays or changes the value of Postfix configuration parameters.


Creates a file in the maildrop directory and copies it's standard input to the file.


Controls the operation of the Postfix mail system.


Sends requests to the specified service over a local transport channel.


Locks a mail folder for exclusive use, and executes commands passed to it.


A Postfix-compatible logging interface for use in, for example, shell scripts.


Creates or queries one or more Postfix lookup tables, or updates an existing one.


The Postfix user interface for queue management.


The Postfix user interface for superuser queue management.


Provides read-only table lookup services to other Postfix processes.


A daemon that awaits the arrival of incoming mail and arranges for its delivery.


A daemon that receives one message per connection, and pipes it through the cleanup daemon, and places it into the incoming queue.


Maintains a connection cache used for sharing a connection multiple times.


The Postfix to Sendmail compatibility interface.


A daemon that reports the Postfix mail queue status.


Looks up a list of mail exchanger addresses for the destination host, sorts the list by preference, and connects to each listed address until it finds a server that responds.


Accepts network connection requests and performs zero or more SMTP transactions per connection.


Listens on a port as specified in the Postfix file and spawns an external command whenever a connection is established.


Maintains the TLS session cache and acts as the PRNG manager.


A daemon that rewrites addresses to standard form.


Maintains a record of what recipient addresses are known to be deliverable or undeliverable.


Delivers mail to virtual user's mail directories.

Last updated on 2006-10-19 09:06:22 -0500