Download location (HTTP): Download location (FTP): ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-2.0.7.tar.gz Version used: 2.0.7 Package size: 1.3 MB Estimated Disk space required: 71.9 MB Estimated build time: 0.92 |
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).
postfix depends on: db-4.1.25 |
Before you compile the program, you need to create users and groups that will be expected to be in place when the install script executes. Add the users and groups with the following commands:
groupadd postfix && groupadd postdrop && groupadd -g 65534 nogroup && useradd -c postfix -d /dev/null -g postfix -s /bin/false postfix && useradd -c nobody -d /home -g nogroup -s /bin/bash -u 65534 nobody && chown postfix:postfix /var/mail |
Install postfix by running the following commands:
make && make install |
The install script will enter an interactive stage with questions in the form of '*_directory:[default]input'. Defaults can be accepted in all but three cases. The following shows the three cases and the modified response.
daemon_directory:[/usr/libexec/postfix]/usr/sbin manpage_directory:[/usr/local/man]/usr/share/man sample_directory:[/etc/postfix]/usr/share/doc/postfix |
The final installation step is to install the program's documentation with this command:
cp -rf html/* /usr/share/doc/postfix |
/etc/aliases, /etc/postfix/main.cf and /etc/postfix/master.cf
cat > /etc/aliases << "EOF" # Begin /etc/aliases MAILER-DAEMON: postmaster postmaster: root root: LOGIN # End /etc/aliases EOF |
The /etc/aliases file that was just created, the main.cf and the master.cf 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 main.cf 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 main.cf file is self documenting, so load it into your editor to make the changes you need for your situation.
cp /etc/aliases /etc/aliases.bak cp /etc/postfix/main.cf /etc/postfix/main.cf.bak cp /etc/postfix/master.cf /etc/postfix/master.cf.bak sed "s/LOGIN/[user]/" /etc/aliases.bak > /etc/aliases sed "s/#myhostname = host.domain.tld/myhostname = \ [localhost.localdomain]/" \ /etc/postfix/main.cf.bak > /etc/postfix/main.cf /usr/bin/newaliases /usr/sbin/postfix start |
To automate the running of postfix, use following command to create the init.d script:
cat > /etc/rc.d/init.d/postfix << "EOF" #!/bin/sh # Begin $rc_base/init.d/postfix # Based on sysklogd script from LFS-3.1 and earlier. # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org source /etc/sysconfig/rc source $rc_functions case "$1" in start) echo "Starting Postfix..." loadproc postfix start ;; stop) echo "Stopping Postfix..." loadproc postfix stop ;; reload) echo "Reloading Postfix..." loadproc postfix reload ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {start|stop|reload|restart}" exit 1 ;; esac # End $rc_base/init.d/postfix EOF chmod 755 /etc/rc.d/init.d/postfix |
Create the symbolic links to this file in the relevant rc.d directory with the following commands:
cd /etc/rc.d/init.d && ln -sf ../init.d/postfix ../rc0.d/K25postfix && ln -sf ../init.d/postfix ../rc1.d/K25postfix && ln -sf ../init.d/postfix ../rc2.d/K25postfix && ln -sf ../init.d/postfix ../rc3.d/S35postfix && ln -sf ../init.d/postfix ../rc4.d/S35postfix && ln -sf ../init.d/postfix ../rc5.d/S35postfix && ln -sf ../init.d/postfix ../rc6.d/K25postfix |
The postfix package contains bounce, cleanup, error, flush, lmtp, local, mailq, master, newaliases, nqmgr, pickup, pipe, postalias, postcat, postconf, postdrop, postfix, postkick, postlock, postlog, postmap, postqueue, postsuper, qmgr, qmqpd, sendmail, showq, smtp, smtpd, spawn, trivial-rewrite, and virtual.
postfix is the program that starts and stops the mail delivery system.
master is the resident process that runs bounce, cleanup, error, flush, lmtp, local, nqmgr, pickup, pipe, qmgr, qmqpd, showq, smtp, smtpd, spawn, trivial-rewrite and virtual on demand. These programs are not designed to work as user commands.
postqueue implements the Postfix user interface for queue management. It implements all the operations that are traditionally available via the sendmail command.
sendmail implements the Postfix to Sendmail compatibility interface. mailq and newaliases are symlinks to sendmail.
showq will emulate the mailq command when the Postfix mail system is not running.
postsuper does maintenance jobs on the Postfix queue.
postalias creates, queries or updates Postfix alias databases.
postcat prints the contents of a Postfix queue file in human-readable form.
postconf prints or changes the value of configuration parameters.
postdrop creates a file in the maildrop directory and copies its standard input to the file.
postkick makes the mail system private IPC accessible for use in shell scripts.
postlock locks a file for exclusive access and executes a command on that file.
postlog implements a logging interface for use in shell scripts.
postmap creates, queries or updates Postfix lookup tables.