Pre-Installation steps
Before installing Postfix, make sure that Sendmail is not already running on your system.
# /sbin/service sendmail status
If Sendmail is running on your system it is necessary to stop it before installing and configuring Postfix. To stop Sendmail, run the following command as super user:
# /sbin/service sendmail stop
Then ensure the Sendmail will not automatically restart when the system is rebooted. Run the below command to find out which run levels will automatically start sendmail:
# /sbin/chkconfig --list | grep sendmail
The result will be similar to:
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
This means that the Sendmail restarts automatically when the system boots into runlevels 2, 3, 4 or 5.
Turn off the Sendmail:
# /sbin/chkconfig sendmail off
Now the run levels settings for Sendmail are changed. To verify the settings run chkconfig one more time as follows:
# /sbin/chkconfig --list | grep sendmail
And check that the output is as follows:
sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Sendmail is now switched off and configured so that it does not auto start when the system is booted. We can now move on to installing Postfix.
Installing Postfix
To verify if Postfix is already installed, use the following rpm command in a Terminal window:
# rpm -q postfix
If the postfix is not installed, it can be installed as follows:
# yum install postfix
The main configuration settings for Postfix are located in the /etc/postfix/main.cf file. Edit Postfix configuration file /etc/postfix/main.cf in your favorite editor and make following changes.
# vim /etc/postfix/main.cf
myhostname = mail.hostname
mydomain = domain name
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = add your network range
home_mailbox = Maildir/
Restart Postfix service to read changes in configuration.
# service postfix restart
Configure to autostart on system boot.
# chkconfig postfix on