Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Postfix installation on Centos 6  (Read 1528 times)

0 Members and 1 Guest are viewing this topic.

nandulalr

  • Guest
Postfix installation on Centos 6
« on: April 27, 2018, 03:14:40 pm »
Pre-Installation steps

Before installing Postfix, make sure that Sendmail is not already running on your system.
Code: [Select]
# /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:
Code: [Select]
# /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:
Code: [Select]
# /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:
Code: [Select]
# /sbin/chkconfig sendmail off

Now the run levels settings for Sendmail are changed. To verify the settings run chkconfig one more time as follows:
Code: [Select]
# /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:
Code: [Select]
# rpm -q postfix

If the postfix is not installed, it can be installed as follows:
Code: [Select]
# 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.
Code: [Select]
# 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.
Code: [Select]
# service postfix restart

Configure to autostart on system boot.
Code: [Select]
# chkconfig postfix on