Step 1 – Installing Dovecot

Dovecot package is available under the default yum repositories. Simply run the below command from terminal to install Dovecot packages on your CentOS 7 system.

Step 2 – Configure Dovecot

Once the installation finished, configure Dovecot server as per your requirements. Here is the quick and useful configuration of Dovecot to work on your system.

Edit Dovecot main configuration file and uncomment below lines to enable POP3 and IMAP protocols. Also configure Dovecot on all interfaces.sudo vi /etc/dovecot/dovecot.conf protocols = imap pop3 lmtp listen = *, :: After that, edit mail configuration file to configure location of the Mailbox. Make sure to set this to correct location where your email server is configure to save users emails.sudo vi /etc/dovecot/conf.d/10-mail.conf mail_location = maildir:~/Maildir Next, edit below configuration file and set the username and group name of the mail server is running with.sudo vi /etc/dovecot/conf.d/10-master.conf unix_listener /var/spool/postfix/private/auth { mode = 0666 user = postfix group = postfix } Finally edit Dovecot SSL configuration file. Set SSL to yes or required. By default it uses self singed certificate, if you have your own certificates update them as followings.sudo vi /etc/dovecot/conf.d/10-ssl.conf ssl = yes ssl_cert =

Step 3 - Manage Dovecot Service

We can manage dovecot using systemctl command line tool. Use the following command to enable and start Dovecot service. Use the below command to view the current status of the service

Step 4 - Test Configuration

I have created an user named “rahul” on my CentOS 7 system. Now, we will access the Mailbox of this user using the mutt command line utility via the IMAPs protocol. Then connect to mailbox using below command: This will prompt to accept certificate (Press a for accept alwys). After that it will prompt for the password. Enter user password and press enter. You will see the emails of your account.

Step 5 - Allow POP3(s)/IMAP(s) Ports in Firewalld

At the end, adjust the firewall rules (if active) to allow POP3(s) and IMAP(s) service to access from the network. Then reload the changes.

Conclusion

You can configured your server to access user mailbox via POP3 or IMAP protocols. You can also configure Roundcube webmail interface to access Mailboxs.

How to Install Dovecot on CentOS 7   TecAdmin - 9