{"id":3584,"date":"2014-09-21T23:53:09","date_gmt":"2014-09-21T15:53:09","guid":{"rendered":"http:\/\/rmohan.com\/?p=3584"},"modified":"2014-09-21T23:53:09","modified_gmt":"2014-09-21T15:53:09","slug":"configure-postfix-on-centosrhel-65","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3584","title":{"rendered":"Configure Postfix on CentOS\/RHEL 6\/5"},"content":{"rendered":"<p><strong>Postfix<\/strong> is fast and popular SMTP server widely used. The main job of postfix is to relay <span id=\"IL_AD2\" class=\"IL_AD\">mail<\/span> locally or to intended destination outside the network. Some of the most popular SMTP servers are Sendmail, Postfix and Qmail. By default Sendmail comes pre-installed with CentOS\/RHEL 5. We will need to remove it and install Postfix. On CentOS\/RHEL 6 \u2018postfix\u2019 are installed by default, so there are no need to install it<\/p>\n<h5 class=\"heading1\">Step 1: Install Postfix<\/h5>\n<p>If <span id=\"IL_AD1\" class=\"IL_AD\">Postfix<\/span> not already installed on your machine, Install it using following command. Also remove sendmail if already installed.<\/p>\n<pre># yum remove sendmail\r\n# yum install postfix \r\n<\/pre>\n<p>Make postfix as default MTA for your system using following command<\/p>\n<pre># alternatives --set mta \/usr\/sbin\/postfix\r\n<\/pre>\n<p>If above command not work and you get output as \u201c\/usr\/sbin\/postfix has not been configured as an alternative for mta\u201c. Use below command to do the same else skip it<\/p>\n<pre># alternatives --set mta \/usr\/sbin\/sendmail.postfix\r\n<\/pre>\n<h5 class=\"heading1\">Step 2: Configure Postfix<\/h5>\n<p>Let\u2019s start postfix configuration. Edit postfix configuration file <strong>\/etc\/postfix\/main.cf<\/strong> in your favorite editor and make following changes. We can also use command line tool <strong>\u2018postconf\u2019<\/strong> to do the same without editing configuration file.<\/p>\n<pre># postconf -e \"myhostname = mail.tecadmin.net\"\r\n# postconf -e \"mydomain = tecadmin.net\"\r\n# postconf -e \"myorigin = $mydomain\"\r\n# postconf -e \"inet_interfaces = all\"\r\n# postconf -e \"mydestination = $myhostname, localhost, $mydomain\"\r\n# postconf -e \"mynetworks = 127.0.0.0\/8, \/32\"\r\n# postconf -e \"relay_domains = $mydestination\"\r\n# postconf -e \"home_mailbox = Maildir\/\"\r\n<\/pre>\n<p>After executing above command edit postfix configuration file and make sure all changes done properly.<\/p>\n<h5 class=\"heading1\">Step 3: Restart Postfix Service<\/h5>\n<p>As we have done basic postfix configuration, So restart postfix service to read changes of configuration. Also configure to auto start on system boot.<\/p>\n<pre># service postfix restart \r\n# chkconfig postfix on\r\n<\/pre>\n<h5 class=\"heading1\">Step 4: Open Firewall Port<\/h5>\n<p>Now if your system is configured to use iptables firewall, So add firewall rules to make postfix accessible from outside, using following commands.<\/p>\n<pre># iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT \r\n# iptables -A INPUT -m state --state NEW -m udp -p udp --dport 25 -j ACCEPT \r\n<\/pre>\n<p>Thanks for using this article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Postfix is fast and popular SMTP server widely used. The main job of postfix is to relay mail locally or to intended destination outside the network. Some of the most popular SMTP servers are Sendmail, Postfix and Qmail. By default Sendmail comes pre-installed with CentOS\/RHEL 5. We will need to remove it and install Postfix. [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3584"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3584"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3584\/revisions"}],"predecessor-version":[{"id":3585,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3584\/revisions\/3585"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}