Postfix-2.11.0

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.

This package is known to build and work properly using an LFS-7.5 platform.

Package Information

Postfix Dependencies

Required

Berkeley DB-6.0.20

Recommended

Optional

MariaDB-10.0.8 or MySQL-5.6.16, OpenLDAP-2.4.39, PCRE-8.34, PostgreSQL-9.3.3, SQLite-3.8.3.1, and CDB or TinyCDB

Note that SQLite, MySQL, PostgreSQL and CDB are only useful if there is a known need for them.

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/postfix

Installation of Postfix

Adding Users and Groups

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 /var/spool/postfix -g postfix \
        -s /bin/false -u 32 postfix &&
chown -v postfix:postfix /var/mail

Configuring the Build

Run the following command to enable Postfix to compile against the current version of BerkeleyDB:

sed -i "s/DB_VERSION_MAJOR == 5/DB_VERSION_MAJOR >= 5/" src/util/dict_db.c

The README files are formatted to be read with a pager like Less or More. If you want to read them in a text editor, make them legible with a sed:

sed -i 's/.\x08//g' README_FILES/*

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.

For more details read the readme files.

Cyrus-SASL

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

CCARGS='-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl'
AUXLIBS='-lsasl2'
OpenLDAP

To use OpenLDAP with Postfix, use the following arguments:

CCARGS='-DHAS_LDAP'
AUXLIBS='-lldap -llber'
Sqlite

To use Sqlite with Postfix, use the following arguments:

CCARGS='-DHAS_SQLITE'
AUXLIBS='-lsqlite3 -lpthread'
MySQL

To use MySQL with Postfix, use the following arguments:

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

To use PostgreSQL with Postfix, use the following arguments:

CCARGS='-DHAS_PGSQL -I/usr/include/postgresql'
AUXLIBS='-lpq -lz -lm'
CDB/TinyCDB

To use CDB or TinyCDB with Postfix, use the following arguments:

CCARGS='-DHAS_CDB'
AUXLIBS='</path/to/CDB>/libcdb.a'
StartTLS Authentication

To use OpenSSL with Postfix, use the following arguments:

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

Installing Postfix

If you have Cyrus SASL and OpenSSL installed, install Postfix by running the following commands:

make CCARGS="-DUSE_TLS -I/usr/include/openssl/                     \
             -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl" \
     AUXLIBS="-lssl -lcrypto -lsasl2"                              \
     makefiles &&
make

This package does not come with a useful test suite.

Now, as the root user:

sh postfix-install -non-interactive \
   daemon_directory=/usr/lib/postfix \
   manpage_directory=/usr/share/man \
   html_directory=/usr/share/doc/postfix-2.11.0/html \
   readme_directory=/usr/share/doc/postfix-2.11.0/readme

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. If the html_directory and readme_directory options are not set then the documentation will not be installed.

Configuring Postfix

Config Files

/etc/aliases, /etc/postfix/main.cf, and /etc/postfix/master.cf

Configuration Information

Create (or append to an existing) /etc/aliases with the following command. Change <LOGIN> for your non-root login identity so mail addressed to root can be forwarded to you. As the root user:

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

MAILER-DAEMON:    postmaster
postmaster:       root

root:             <LOGIN>
# End /etc/aliases
EOF

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.

[Note]

Note

The /etc/postfix/main.cf and /etc/postfix/master.cf files must be personalized for your system. The main.cf file needs your fully qualified hostname. You will find that main.cf is self documenting, so load it into your editor to make the changes you need for your situation.

[Note]

Note

Postfix can also be set up to run in a chroot jail. See the file in the source examples/chroot-setup/LINUX2 for details.

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-20140301 package.

make install-postfix

Contents

Installed Programs: mailq, newaliases, postalias, postcat, postconf, postdrop, postfix, postkick, postlock, postlog, postmap, postmulti, postqueue, postsuper, and sendmail
Installed Libraries: None
Installed Directories: /etc/postfix, /usr/lib/postfix, /usr/share/doc/postfix-2.11.0, /var/lib/postfix, and /var/spool/postfix

Short Descriptions

mailq

A symlink to sendmail.

newaliases

A symlink to sendmail.

postalias

is a utility for Postfix alias database maintenance

postcat

Prints the contents of files from the Postfix queue in human readable format.

postconf

Displays or changes the value of Postfix configuration parameters.

postdrop

Creates a file in the maildrop directory and copies its standard input to the file.

postfix

is the Postfix control program.

postkick

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

postlock

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

postlog

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

postmap

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

postmulti

is the Postfix multi-instance manager. It allows a system administrator to manage multiple Postfix instances on a single host.

postqueue

The Postfix user interface for queue management.

postsuper

The Postfix user interface for superuser queue management.

sendmail

is the Postfix to Sendmail compatibility interface.

Last updated on 2014-02-20 03:30:41 -0800