Monday, February 22, 2016

Install Postfix Mail Server with Dovecot and Squirrelmail on CentOS/RHEL

A commonly used Mail Transfer Agent (MTA) is postfix and this is the default MTA of RHEL. The key benefits are Easy to control, Secure and Faster MTA

Prerequirements
In order to install postfix you need to remove the other MTA’s
[root@myserver ~]# yum install postfix -y
Configuring Postfix
Open Postfix config file /etc/postfix/main.cf and find and edit the following lines
## Line no 75 – Uncomment and set your mail server FQDN ##
myhostname = server.myserver.com
## Line 83 – Uncomment and Set domain name ##
mydomain = myserver.com
## Line 99 – Uncomment ##
myorigin = $mydomain
## Line 116 – Set ipv4 ##
inet_interfaces = all
## Line 119 – Change to all ##
inet_protocols = all
## Line 164 – Comment ##
#mydestination = $myhostname, localhost.$mydomain, localhost,
## Line 165 – Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
## Line 264 – Uncomment and add IP range ##
mynetworks = 192.168.1.0/24, 127.0.0.0/8
## Line 419 – Uncomment ##
home_mailbox = Maildir
Don’t forget to save the files before exit. Now you can start your postfix service.
[root@myserver ~]# /etc/init.d/postfix start
[root@myserver ~]# /etc/init.d/postfix status master (pid  1290) is running…
[root@myserver ~]# chkconfig postfix on
Now you can test your postfix server. Access the server via telnet and enter the commands shown in cots, First we need to create a test user called “bharath”
[root@myserver ~]# useradd bharath
[root@myserver ~]# passwd bharath
[root@myserver ~]# telnet localhost smtp
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 server.myserver.com ESMTP Postfix
ehlo localhost”
250-server.myserver.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<bharath>”
250 2.1.0 Ok
rcpt to:<bharath>”
250 2.1.5 Ok
data”
354 End data with <CR><LF>.<CR><LF>
welcome to myserver mail system”
.”
250 2.0.0 Ok: queued as 3E68E284C
quit”
221 2.0.0 Bye
Connection closed by foreign host.

That's it.


No comments:

Post a Comment