CentOS - Mail Server - Dovecot Installation
Following from the previous article, we have installed Postfix and setup a basic configuration with a secure connection to our mail server. As such, we can move on to installing Dovecot which will allow us to access the mail server with POP and IMAP access (as well as secure POP and IMAP).
Installation
Installation of the Dovecot package is very simple using the yum package manager.
Let's go ahead and install Dovecot:
sudo yum install dovecot
Note that MySQL will also be installed due to the dependencies of Dovecot, but we will not be referencing the application in this series.
Done.
Configure
Now we need to configure Dovecot to enable SASL authentication as we did with Postfix in the previous article(link).
First thing is to open the main Dovecot configuration file:
sudo nano /etc/dovecot.conf
and uncomment the following option:
protocols - imap imaps pop3 pop3s
This setting instructs Dovecot to listen for IMAP (143), IMAPS (993), POP3(110), and POP3S(995) connections to our mail server.
The IMAPS and POP3S protocols are used when making secure connections to the mail server.
SSL/TLS
To configure secure connections, we also need to specify the location of our SSL certificate that was generated in the last article (link).
Locate the following lines in the dovecot.conf file:
#ssl_cert_file = /etc/pki/dovecot/certs/dovecot.pem
#ssl_key_file = /etc/pki/dovecot/private/dovecot.pem
and replace them with our SSL certificate as such:
ssl_cert_file = /etc/pki/tls/certs/mail.demoslice.com.cert
ssl_key_file = /etc/pki/tls/private/mail.demoslice.com.key
Good.
Let's save the file and move on.
Start
Now that we have made the necessary changes to the Dovecot setup we need to start the application.
sudo /etc/init.d/dovecot start
Summary
Installing and configuring Dovecot is a fairly easy process that entails adjusting only a few lines of the default configuration.
This now allows us POP, secure POP, IMAP and secure IMAP access to our mail server.
However, unless we open some ports in our firewall no one will be able to access these services. We'll look at that in the next article.

