How to Install and Configure Dovecot on CentOS?

Dovecot is an open-source IMAP and POP3 Mail Server for Linux and UNIX Operating Systems, which is used to receive incoming emails on a server from Postfix.

We believe you have Postfix preinstalled. We are doing this configuration in Centos 6, and the steps to install Dovecot on Centos are listed below –  

1. Install Dovecot using the command below – 

# sudo yum install dovecot

2. Once it is installed, you need to configure the dovecot file; open it in vi editors, and make changes as below – 

# vi /etc/dovecot/dovecot.conf
protocols = imap pop3
mail_location = maildir:~/Maildir



Get Linux VPS Hosting

3. Now, we will configure the authentication process file at the /etc/dovecot/conf.d/10-auth.conf path.
Again, use vi editor and uncomment the following line – 

auth_mechanisms = plain login

4. To configure the email location, we will add the below-mentioned line in 10-mail.conf file at /etc/dovecot/conf.d/ location – 

mail_location = maildir:~/Maildir

5. Now, we will configure the UNIX socket for Postfix SMTP AUTH.
To do this, we will modify the /etc/dovecot/conf.d/10-master.conf file and make changes as per the image shown below – 

vi /etc/dovecot/conf.d/10-master.conf

#unix_listener auth-userdb
{

#mode = 0600

     #user =

     #group =

   #
}

 # Postfix smtp-auth

   unix_listener /var/spool/postfix/private/auth

{

    mode = 0666

    user = postfix

    group = postfix

   }



Get Linux VPS Hosting

6. Open file 20-pop3.conf with the below command – 

vi /etc/dovecot/conf.d/20-pop3.conf

7. Uncomment or add the below line if it is not there – 

pop3_uidl_format = %08Xu%08Xv

pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

8. Please use the below-mentioned command to create a user. 

sudo useradd test

Here, we have used a test user.

9. Create the mail directory for the test user.

sudo mkdir /home/test/Maildir

10. Assign the mail directory permission to the created user.

sudo chown test:test /home/test/Maildir

sudo chmod -R 700 /home/test/Maildir

11. Run the command given below to start the dovecot service – 

# sudo service dovecot start

12. To Connect your email client to the SMTP server, you must configure Postfix.

13. Open the /etc/postfix/main.cf file using the vi editor.

sudo vi /etc/postfix/main.cf

14. Add the lines given below – 

# authentication

 smtpd_sasl_security_options = noanonymous

 smtpd_sasl_auth_enable = yes 

 smtpd_sasl_type = dovecot

 smtpd_sasl_local_domain = $hostname

 broken_sasl_auth_clients = yes

 smtpd_sasl_path = private/auth

15. Restart the Postfix service. 

# sudo service postfix restart

16. You will need to allow the ports given below in your Firewall – 

110
143
465
587
993
995

Get Linux VPS Hosting


Was this answer helpful?

« Back

chat