Compile and install Postfix
Unpack the source tarball as follows:
$ tar –xzf postfix-2.0.6.tar.gz
Create a postfix user account, with the primary group named postfix, using your account creation tool of choice. This account should have no shell or home directory—the resulting entry in /etc/passwd should look like this:
postfix:*:12345:12345:postfix:/no/where:/no/shell
Create a postdrop group with no users. The entry in /etc/group should look like this (perhaps with a different group id):
postdrop:*:54321
Add an entry in /etc/alias for the postfix user:
postfix: root
The following makecommand will patch the make files for MySQL support. Also, change the include and lib path to point to the directories containing mysql.h and libmysqlclient. So:
$ cd /usr/src/postfix-2.0.6
$ make –f Makefile.init makefiles \
> 'CCARGS=-DNO_PCRE -DHAS_MYSQL –I/usr/local/mysql/include/mysql'\
> 'AUXLIBS=-L/usr/local/mysql/lib/mysql –lmysqlclient –lz –lm'
Remove the debugging symbols from the source code (optional) with this command:
$ strip bin/* libexec/*
Then compile using:
$ make
Finally, install (as root) using these commands:
$ su
# make install
The install script prompts you for many options. You might want to specify a location in your user home directory for the readme files—otherwise, the defaults are generally fine. Barring any compilation errors, you should now have a working copy of Postfix on your system, with a directory of configuration files in /etc/postfix.
Configuring Postfix
Postfix has a ton of configuration options. After a fresh install, most of them are set to reasonable values. The readme files, sample configuration files, and man pages describe how to work with most of them. While Postfix should run with no changes, there are some settings you may need to change if you're getting error messages, along with a couple of considerations for reducing spam. Using Table A, you may want to change some values in /etc/postfix/main.cf (the main configuration file for options).
|
Next, I need to set up aliases for default system accounts. For now, I'll route the important mail accounts to a local user account, which will need to be read directly by a mail client. To do this, edit the /etc/aliases file and add the following entries:
postfix: root
postmaster: root
abuse: root
root: user
Replace user with your user account name. To generate the actual alias database, type the following as root:
# postalias
Next, check for errors in the Postfix installation, and if you get no error messages, start Postfix:
# postfix check
# postfix start
Postfix sends log messages to the mail facility of syslogd by default. Look for messages from Postfix that include /var/log/maillog, /var/log/mail/warnings, or their equivalents. The tail command can be helpful for this:
$ tail –f /var/log/maillog
Automatic startup
Finally, set Postfix to run automatically at startup. The procedure to do this varies widely by system, and the package does not provide a script. If your distribution uses System V for starting and stopping services, the accompanying sidebar provides a sample script you can use. Save this script as /etc/rc.d/init.d/postfix.
Once this script is saved, you can use the chkconfig program to set the run levels for postfix, and make the script executable using:
# chkconfig --add postfix
# chmod 744 /etc/rc.d/init.d/postfix
What's next?
Postfix should now be up and running, accepting mail for local users and aliases in the /etc/alias file, and relaying mail out. In the next article, I will set up an IMAP server so that other users can get to e-mail stored on the server and store virtual user accounts in a MySQL database.
TechRepublic is the online community and information resource for all IT professionals, from support staff to executives. We offer in-depth technical articles written for IT professionals by IT professionals. In addition to articles on everything from Windows to e-mail to fire walls, we offer IT industry analysis, downloads, management tips, discussion forums, and e-newsletters.
©2001 TechRepublic, Inc.



4%
4%






