How to Install Dovecot on Cent OS
Hi All,
Today We are going to see how to install Dovecot on Cent OS.
Now install Dovecot using the following command:
yum -y install dovecot
Once Dovecot is installed, edit the following file using your favorite editor.
nano /etc/dovecot/conf.d/10-master.conf
and find the following lines:
# Postfix smtp-auth
Now Append the following lines, just below these lines:
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0660
user = postfix
group = postfix
}
Now open another configuration using the following command.
nano /etc/dovecot/conf.d/10-auth.conf
and find the following lines.
# Space separated list of wanted authentication mechanisms:
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
# gss-spnego
# NOTE: See also disable_plaintext_auth setting.
auth_mechanisms = plain
Append login
at the end of the line auth_mechanisms = plain
to make it look like
auth_mechanisms = plain login
Again edit /etc/dovecot/conf.d/10-mail.conf
file using your favorite editor.
nano /etc/dovecot/conf.d/10-mail.conf
Find the following lines
#
#
#mail_location =
Now add the following line just below these lines:
mail_location = maildir:~/mail
Now edit /etc/dovecot/conf.d/20-pop3.conf
using your favorite editor.
nano /etc/dovecot/conf.d/20-pop3.conf
and find the following lines.
#pop3_uidl_format = %08Xu%08Xv
Uncomment the above line to make it look like as shown below.
# Note that Outlook 2003 seems to have problems with %v.%u format which was
# Dovecot's default, so if you're building a new server it would be a good
# idea to change this. %08Xu%08Xv should be pretty fail-safe.
#
pop3_uidl_format = %08Xu%08Xv
Now restart postfix, and dovecot using the following command.
systemctl restart postfix
systemctl enable postfix
systemctl restart dovecot
systemctl enable dovecot
Now if you have a firewall running you will need to allow port number 25, 587, 465, 110, 143, 993, 995 and 80. All the ports except 80 are used to send and receive emails and port 80 is used to make HTTP connections. HTTP connections will be used to access Squirrelmail using web interface.
To unblock all these ports from firewall, run the following commands.
firewall-cmd --permanent --add-service=smtp
firewall-cmd --permanent --add-port=587/tcp
firewall-cmd --permanent --add-port=465/tcp
firewall-cmd --permanent --add-port=110/tcp
firewall-cmd --permanent --add-service=pop3s
firewall-cmd --permanent --add-port=143/tcp
firewall-cmd --permanent --add-service=imaps
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
Testing Postfix and Dovecot
You can check if Postfix is working by executing the following command in your terminal.
telnet mail.yourdomain.com smtp
If you do not have telnet installed, then you can run the following command to install telnet.
yum -y install telnet
Once you are connected using telnet you will see following output.
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail.rackvoucher.com ESMTP Postfix
Now you can also send email using telnet. Use the following command to enter the sender username.
mail from:
To enter the email of recipient, you can use the use the following command.
rcpt to:
To enter the body of email, enter the following command.
data
Once you have entered your message, enter dot (.) to finish the message. Finally enter quit
to exit telnet.
To test Dovecot, enter the following command.
telnet mail.yourdomain.com pop3
You will see following output,
Trying 104.36.18.239...
Connected to mail.rackvoucher.com.
Escape character is '^]'.
+OK Dovecot ready.
It tells that Dovecot is working fine, you can login to your mail account by providing login
command, then use pass
command to enter your password. To view the mails in your account, use retr
command.
user mailuser
+OK
pass Password
+OK Logged in.
retr
-ERR There's no message 1.
quit
+OK Logging out.
Connection closed by foreign host.
Thanks for reading this tutorial 🙂