How to install Postfix on CentOS?

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.
[root@server ~]# 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 -
[root@server ~]# service iptables stop
[root@server ~]# service ip6tables stop
[root@server ~]# chkconfig iptables off
[root@server ~]# chkconfig ip6tables off

Installation

Use below command to install postfix - 
[root@server ~]# yum install postfix

Configuration

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

Find the below lines and edit them as shown below -
[root@server ~]# 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 - 
[root@server ~]# service postfix start
Starting postfix:                                          [  OK  ]
[root@server ~]# chkconfig postfix on

Testing the postfix -
[root@server ~]# telnet localhost smtp

Check Mail -
Navigate to the user mail directory and check for the new mail - 
[root@server ~]# cd /home/user1/Maildir/new/
[root@server new]# ls

After 'ls' command, you'll get the details of email with date, time, to and from. 
All done! Smile Postfix working now.

Was this answer helpful?

 Print this Article

Also Read

How to install Imagic?

1. # yum install ImageM* netpbm gd gd-* libjpeg libexif gcc coreutils make 2.  # cd...

How to change the port number of Apache Web Server?

Default port to access the Apache is 80. Secure port for communicating with world for Apache is...

Basic exim commands

1. REMOVE MAILS BY ID - /usr/sbin/exim -v -Mrm (MAIL ID HERE) 2. LIST QUEUED MAILS -...

How to install MariaDB on CentOS 7?

1. Insatll MariaDB on server -  #yum install mariadb-server OR #yum install -y mariadb...

How to setup the email alert for low disk space?

If you don't want to setup to a full monitoring solution such as Nagios you can create your own...

Powered by WHMCompleteSolution