Switching to postfix on RHEL

The RHEL 6 documentation contains most of the info you’ll need for this, superceeding whatever may have come before. This includes using the alternatives subsystem to alias sendmail executable names to their postfix equivalents. Check out the links below.

Main Transport Agents in the RHEL Deployment Guide.

If you already have sendmail installed (it is the default MTA in RHEL 6 and previous versions), you need to first shut it down and then disable it:

service sendmail stop
chkconfig sendmail off

Then, once you’ve installed the requisite packages, start up postfix and enable it:

service postfix start
chkconfig postfix on

Next, configure postfix for the role it will play. By default it only allows the relaying of mail from the local host. To relay mail from other hosts or the Internet you will need to modify the configuration. See Basic Postfix Configuration for specifics. Here’s the gist from that doc:

Edit the /etc/postfix/main.cf file with a text editor, such as vi.
> Uncomment the mydomain line by removing the hash sign (#), and replace domain.tld with the domain the mail server is servicing, such as example.com.
> Uncomment the myorigin = $mydomain line.
> Uncomment the myhostname line, and replace host.domain.tld with the hostname for the machine.
> Uncomment the mydestination = $myhostname, localhost.$mydomain line.
> Uncomment the mynetworks line, and replace with a valid network setting for hosts that can connect to the server.
> Uncomment the inet_interfaces = all line.
> Comment the inet_interfaces = localhost line.
> Restart the postfix service.

Note that /etc/mail/aliases is shared by sendmail and postfix, so you’ll be able to continue using it even after the switch.

Finally, invoke the alternatives subsystem to alias common sendmail executable names to their postfix equivalents (so that the configuration of other apps, like php, won’t have to be modified to change their command syntax and path information).

alternatives --config mta

Follow the prompts and select postfix as your MTA.

The official Postfix documentation page points to a wealth of well-written articles that really should be consulted by anyone charged with administering systems running postfix.

This entry was posted in System Administration on by .

About phil

My name is Phil Lembo. In my day job I’m an enterprise IT architect for a leading distribution and services company. The rest of my time I try to maintain a semi-normal family life in the suburbs of Raleigh, NC. E-mail me at philipATlembobrothersDOTcom. The opinions expressed here are entirely my own and not those of my employers, past, present or future (except where I quote others, who will need to accept responsibility for their own rants).