Install and Configure Postfix


Due to the numerous vulnerabilities available for mail server services and the potential for disaster that those vulnerabilities can cause on production servers, not to mention the fact that Sendmail can be a major pain to configure and maintain. The following information is how to go about installing and configuring for Postfix. This will mainly be used during builds, but can be used by anyone planning a migration from Sendmail to Postfix and the same information could likely be used to migrate back.

Install the Postfix packages

Just like sendmail, its one package and can be found through RHN's up2date and yum command, RHN Web download, or CD. To save yourself some extra work, get and install both of the following rpms:
  • postfix
  • system-switch-mail (possibly called redhat-switch-mail)

Switch Mail Agents

If you installed the switch-mail program, this'll be easy....
  1. Run sudo system-switch-mail(or redhat-switch-mail)
  2. Select Postfix
  3. Hit Enter
    • You'll be told the MTA configuration has successfully updated. Hit Enter again
  4. sudo /sbin/chkconfig --list postfix
    • Verify that your runlevel is turned on
    • If not, chkconfig --levels 35 postfix on
  5. sudo /sbin/service postfix status
    • Verify postfix is running
  6. Test Postfix's basic function
    • echo blah | mail -s test root
    • sudo tail /var/log/maillog to verify the mail was delivered
    • run 'sudo su -root -c mail' and check for your test to root
  7. Move on to the configuration section
  8. Your choice on whether to remove the mail switch agent. You might need it later and its not likely to have security patches. If it does, you can always remove it then.

Basic Postfix Configuration

  1. sudo vi /etc/postfix/main.cf
    • Modify the following entries
o    myhostname = [systemname].{your domain}
o    mydomain = {your domain}
o    inet_interfaces = localhost
o    relayhost = {your relayhost}
  1. sudo vi /etc/postfix/master.cf
    • To set the chroot change:
      • smtp inet n - n - - smtpd
    • to
      • smtp inet n - y - - smtpd