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: Install Postfix on CentOS  (Read 1548 times)

0 Members and 1 Guest are viewing this topic.

vyshakhv

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Install Postfix on CentOS
« on: April 07, 2018, 04:54:07 pm »
Postfix is an open-source Mail Transport Agent (MTA), which supports protocols like LDAP, SMTP AUTH (SASL), and TLS. It routes and delivers emails.

You will need to uninstall the sendmail from the server before installing the postfix because sendmail is the default MTA in Redhat/CentOS.
Code: [Select]
yum remove sendmail

Requirement -

 i. The server should have correct MX records.
 ii.  Firewall should be disabled. You can use below command to disable the firewall -
Code: [Select]
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off

Installation

Use below command to install postfix -
Code: [Select]
yum install postfix

Configuration

Open the postfix config file
/etc/postfix/main.cf

Find the below lines and edit them as shown below -
Code: [Select]
vi /etc/postfix/main.cf
myhostname = your server hostname
mydomain = your domain name
myorigin = $your domain name
inet_interfaces = all 
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks =  add your network range
home_mailbox = Maildir/

Start the postfix service
Code: [Select]
service postfix start
Starting postfix:                                          [  OK  ]
chkconfig postfix on

Testing the postfix -
Code: [Select]
telnet localhost smtp

Check Mail
Navigate to the user mail directory and check for the new mail
Code: [Select]
cd /home/user1/Maildir/new/
ls
After 'ls' command, you'll get the details of email with date, time, to and from.
   
All done! Postfix working now.