<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>postfix mail server installation on centos Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/postfix-mail-server-installation-on-centos/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 20 Feb 2020 19:02:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install Postfix Mail Server on RHEL / CentOS 8</title>
		<link>https://www.osradar.com/how-to-install-postfix-mail-server-on-rhel-centos-8/</link>
					<comments>https://www.osradar.com/how-to-install-postfix-mail-server-on-rhel-centos-8/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Thu, 20 Feb 2020 19:02:31 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[how to install postfix mail server on centos 8]]></category>
		<category><![CDATA[install postfix mail server]]></category>
		<category><![CDATA[postfix mail server]]></category>
		<category><![CDATA[postfix mail server installation on centos]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=18286</guid>

					<description><![CDATA[<p>Today we are going to learn that How To Install Postfix Mail Server on RHEL / CentOS 8. Let&#8217;s have a short Introduction about Postfix. What is Postfix? Postfix is a common Mail Server, many huge distributions are shipped with Postfix deployed by default. By the default configuration it permits local mailing , however in [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-postfix-mail-server-on-rhel-centos-8/">How To Install Postfix Mail Server on RHEL / CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Today we are going to learn that <a href="https://www.osradar.com/?p=18286">How To Install Postfix Mail Server on RHEL / CentOS 8</a>. Let&#8217;s have a short Introduction about Postfix.</p>



<h3><strong>What is Postfix?</strong></h3>



<p>Postfix is a common Mail Server, many huge distributions are shipped with Postfix deployed by default. By the default configuration it permits local mailing , however in itself it is very useful on a machine used by many customers, or even if there may be no such visitors, many services dump their reviews and messages into e-mails, which is introduced to the root consumer locally, so the sysadmin might be noticed on any activities when he/she logs in and switches to root user.</p>



<p>A simple instance could be scheduled cron jobs: Any output no longer redirected from the output of a script strolling from cron can be wrapped to an electronic mail and will be delivered to root&#8217;s mailbox, so the administrator does no longer even ought to make any effort to have the reports of the nightly backup jobs to hand.</p>



<p>At the same time as this standalone mode is virtually a nice carrier as it&#8217;s far, Postfix is a complete-fledged Mail Server, capable of doing the following functions:</p>



<ul><li> <strong>receiving of mails </strong></li><li><strong> forwarding </strong></li><li><strong> relaying</strong></li><li><strong> filtering of e-mails</strong></li></ul>



<p> Postfix essentially have every feature we need for a Mail Server.</p>



<h3><strong>Step 1: Update Your System</strong></h3>



<p>As it is good practice to update your system before installing new packages as we do every time.</p>



<pre class="wp-block-verse">sudo dnf update</pre>



<p>Make sure that you are not using any other mail servers as they will raise problems with Postfix.</p>



<h3><strong>Step 2: Set Hostname </strong></h3>



<p>Run the following command with root privileges or root user as it will require you to enter root password. </p>



<p>hostnamectl set-hostname server1.osradar.com<br>exec bash</p>



<p>Then add the following entries in the <strong>/etc/hosts</strong> file.</p>



<pre class="wp-block-verse">sudo nano /etc/hosts<br>104.37.86.29                server1.osradar.com</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="721" height="171" src="https://www.osradar.com/wp-content/uploads/2020/02/osradar-server.png" alt="" class="wp-image-18343" srcset="https://www.osradar.com/wp-content/uploads/2020/02/osradar-server.png 721w, https://www.osradar.com/wp-content/uploads/2020/02/osradar-server-300x71.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/osradar-server-696x165.png 696w" sizes="(max-width: 721px) 100vw, 721px" /></figure></div>



<p>After it Save &amp; exit the hosts file.</p>



<h3><strong>Step 3: Installing Postfix Mail Server</strong></h3>



<p>After doing all the above steps, run the following command to Install Postfix Mail Server.</p>



<pre class="wp-block-verse">sudo dnf postfix</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="731" height="495" src="https://www.osradar.com/wp-content/uploads/2020/02/postfix.png" alt="" class="wp-image-18344" srcset="https://www.osradar.com/wp-content/uploads/2020/02/postfix.png 731w, https://www.osradar.com/wp-content/uploads/2020/02/postfix-300x203.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/postfix-696x471.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/postfix-620x420.png 620w" sizes="(max-width: 731px) 100vw, 731px" /></figure></div>



<p>Then start &amp; enable postfix services.</p>



<pre class="wp-block-verse">sudo systemctl start postfix<br>sudo systemctl enable postfix</pre>



<p>Now, check the status of Postfix services.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="727" height="350" src="https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix.png" alt="" class="wp-image-18345" srcset="https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix.png 727w, https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-300x144.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-696x335.png 696w" sizes="(max-width: 727px) 100vw, 727px" /></figure></div>



<p>You can see that the Postfix service is running fine. It&#8217;s time to configure the Postfix to send emails from Postfix locally to our Server.</p>



<h3><strong>Step 4: Installing mailx email client</strong></h3>



<p>Install mailx email client feature before proceeding further by</p>



<pre class="wp-block-verse">sudo dnf install mailx</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="724" height="427" src="https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-mailx.png" alt="" class="wp-image-18346" srcset="https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-mailx.png 724w, https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-mailx-300x177.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-mailx-696x410.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-mailx-712x420.png 712w" sizes="(max-width: 724px) 100vw, 724px" /></figure></div>



<h3><strong>Step 5: Configuring Postfix Mail Server</strong></h3>



<p>Now, configure the Postfix file located under <strong>/etc/postfix/main.cf</strong> with root access. Open the file with your favorite editor and make certain changes as required like given below</p>



<pre class="wp-block-verse">sudo nano /etc/postfix/main.cf</pre>



<p>And then do the following changes</p>



<pre class="wp-block-verse">##############Uncomment these and set your domain ############## <br><strong>myhostname = server1.osradar.com<br>mydomain = osradar.com<br>myorigin = $mydomain</strong><br> ############## Uncomment and Set inet_interfaces to all ############## <br> <strong>inet_interfaces = all</strong><br> ##############Change to all ############## <br> <strong>inet_protocols = all</strong><br>  ############## Comment ############## <br><strong> mydestination = $myhostname, localhost.$mydomain, localhost</strong><br> ############## Uncomment ############## <br> <strong>mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain</strong><br> Uncomment <br> <strong>mynetworks = 168.100.189.0/28, 127.0.0.0/8</strong><br> Uncomment<br> home_mailbox = Maildir/</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="732" height="495" src="https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-on-centos-8.png" alt="" class="wp-image-18349" srcset="https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-on-centos-8.png 732w, https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-on-centos-8-300x203.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-on-centos-8-696x471.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/how-to-install-postfix-on-centos-8-621x420.png 621w" sizes="(max-width: 732px) 100vw, 732px" /></figure></div>



<p>After doing the changes, save the configuration file &amp; exit.</p>



<p>Then restart postfix services.</p>



<pre class="wp-block-verse">sudo systemctl restart postfix</pre>



<h3><strong>Step 6: Test Postfix Mail Server</strong></h3>



<p>Make sure that the configuration is working fine, test it by creating user</p>



<pre class="wp-block-verse">useradd postfix<br>passwd osradar</pre>



<p>After it install the telnet to send emails.</p>



<p>Then run the following command to send email from <strong>sabi </strong>local user to another <strong>osradar</strong> user.</p>



<pre class="wp-block-verse">telnet localhost smtp<br>or<br>telnet localhost 25</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="699" height="175" src="https://www.osradar.com/wp-content/uploads/2020/02/send-emails-from-postfix-.png" alt="" class="wp-image-18350" srcset="https://www.osradar.com/wp-content/uploads/2020/02/send-emails-from-postfix-.png 699w, https://www.osradar.com/wp-content/uploads/2020/02/send-emails-from-postfix--300x75.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/send-emails-from-postfix--696x175.png 696w" sizes="(max-width: 699px) 100vw, 699px" /></figure></div>



<p>It confirms that the Mail Server is working fine. Then type the command</p>



<pre class="wp-block-verse">ehlo localhost</pre>



<p>You will see the following output:</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="737" height="370" src="https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-test-email-sending.png" alt="" class="wp-image-18351" srcset="https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-test-email-sending.png 737w, https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-test-email-sending-300x151.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/install-postfix-and-test-email-sending-696x349.png 696w" sizes="(max-width: 737px) 100vw, 737px" /></figure></div>



<p>This shows that all settings are fine &amp; you can find the email sent at the user&#8217;s home directory. Run the following commands highlighted in green to send email.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="495" height="220" src="https://www.osradar.com/wp-content/uploads/2020/02/highlighted-text-postfix.png" alt="" class="wp-image-18352" srcset="https://www.osradar.com/wp-content/uploads/2020/02/highlighted-text-postfix.png 495w, https://www.osradar.com/wp-content/uploads/2020/02/highlighted-text-postfix-300x133.png 300w" sizes="(max-width: 495px) 100vw, 495px" /></figure></div>



<p>To read this email, just use the <strong>cat</strong> command with the above result:</p>



<pre class="wp-block-verse">sudo ls /home/sabi/Maildir/new<br><strong>1582039913.Vfd00I10188c4M499438.server1.osradar.com</strong></pre>



<p>The Output will be similar to this as I&#8217;ve highlighted with different color. You can see how it works</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="750" height="260" src="https://www.osradar.com/wp-content/uploads/2020/02/final-seeing-of-postfix-mail-.png" alt="" class="wp-image-18353" srcset="https://www.osradar.com/wp-content/uploads/2020/02/final-seeing-of-postfix-mail-.png 750w, https://www.osradar.com/wp-content/uploads/2020/02/final-seeing-of-postfix-mail--300x104.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/final-seeing-of-postfix-mail--696x241.png 696w" sizes="(max-width: 750px) 100vw, 750px" /></figure>



<h4><strong>Logs of Postfix</strong></h4>



<p>You can find the Postfix mail server logs under<strong> /var/log/maillog</strong> file.</p>



<pre class="wp-block-verse">tail -f /var/log/maillog</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1024" height="222" src="https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-1024x222.png" alt="" class="wp-image-18354" srcset="https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-1024x222.png 1024w, https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-300x65.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-768x166.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-696x151.png 696w, https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix-1068x231.png 1068w, https://www.osradar.com/wp-content/uploads/2020/02/log-file-postfix.png 1159w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<h3><strong>Step 7: Secure Postfix Mail Server</strong></h3>



<p>As to send email over Internet require Security. So, it is good practice to use SSL certificates. You can get SSL from any trusted authority or Self Signed. Here we will use Self Signed using openssl.</p>



<p>Run the below command to install openssl</p>



<pre class="wp-block-verse">sudo dnf install openssl -y</pre>



<p>Now generate the private key &amp; CSR(Certificate Signing Request) using below commands</p>



<pre class="wp-block-verse">openssl req -nodes -newkey rsa:2048 -keyout mail.key -out mail.csr</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="786" height="389" src="https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final.png" alt="" class="wp-image-18355" srcset="https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final.png 786w, https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final-300x148.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final-768x380.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final-324x160.png 324w, https://www.osradar.com/wp-content/uploads/2020/02/openssl-certificates-final-696x344.png 696w" sizes="(max-width: 786px) 100vw, 786px" /></figure>



<pre class="wp-block-verse">openssl x509 -req -days 365 -in mail.csr -signkey mail.key -out mail.crt</pre>



<figure class="wp-block-image size-large"><img loading="lazy" width="795" height="158" src="https://www.osradar.com/wp-content/uploads/2020/02/self-generated-final.png" alt="" class="wp-image-18356" srcset="https://www.osradar.com/wp-content/uploads/2020/02/self-generated-final.png 795w, https://www.osradar.com/wp-content/uploads/2020/02/self-generated-final-300x60.png 300w, https://www.osradar.com/wp-content/uploads/2020/02/self-generated-final-768x153.png 768w, https://www.osradar.com/wp-content/uploads/2020/02/self-generated-final-696x138.png 696w" sizes="(max-width: 795px) 100vw, 795px" /></figure>



<p>Then copy the private key and certificate file to <strong>/etc/postfix</strong> directory.</p>



<pre class="wp-block-verse">sudo cp mail.key mail.crt /etc/postfix</pre>



<p>After it update the Private key &amp; Certificate file&#8217;s path in postfix config file.</p>



<pre class="wp-block-verse">sudo nano /etc/postfix/main.cf</pre>



<pre class="wp-block-verse"><strong>smtpd_tls_cert_file = /etc/postfix/mail.crt <br>smtpd_tls_key_file = /etc/postfix/mail.key </strong><br><strong>smtpd_tls_security_level = may</strong></pre>



<p>Then restart postfix services.</p>



<pre class="wp-block-verse">sudo systemctl restart postfix</pre>



<h4>Now, try to send email from <strong>sabi</strong> to <strong>osradar</strong>.</h4>



<pre class="wp-block-verse">echo "New Message" | mailx -s "Test email from Postfix MailServer" -r sabi@osradar.com osradar@osradar.com</pre>



<p>You can read the email using the following command</p>



<pre class="wp-block-verse">sudo cd /home/osradar/Maildir/new/</pre>



<p>After it send email from <strong>osradar</strong> user to external domain (<strong>seoinbahawalpur.com</strong>)</p>



<pre class="wp-block-verse"> echo "External test email" | mailx -s "Test email Postfix MailServer" -r sabi@osradar.com osradar@seoinbahawalpur.com</pre>



<h3><strong>Checking Postfix Mail Queue</strong></h3>



<p>Run the below command to list mails which are in queue</p>



<pre class="wp-block-verse">mailq</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="263" height="71" src="https://www.osradar.com/wp-content/uploads/2020/02/image-4.png" alt="" class="wp-image-18357"/></figure></div>



<p>See the log file by</p>



<pre class="wp-block-verse">tail -f /var/log/maillog</pre>



<p>So, that&#8217;s how we can Install &amp; Configure Postfix Mail Server on our CentOS Operating System.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-postfix-mail-server-on-rhel-centos-8/">How To Install Postfix Mail Server on RHEL / CentOS 8</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-postfix-mail-server-on-rhel-centos-8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
