How to Install and configure Dovecot on CentOS?

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

Following are the steps to install Dovecot on Centos.

We believe you have Postfix preinstalled. We are doing this configuration in Centos 6.

  1. Install Dovecot using the below command.

    # sudo yum install dovecot


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

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


 

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

    auth_mechanisms = plain login
  2. To configure email location, we will add below line in 10-mail.conf file at /etc/dovecot/conf.d/ location.

    mail_location = maildir:~/Maildir


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

    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
       }


 

  1. Open file 20-pop3.conf with below command.

    vi /etc/dovecot/conf.d/20-pop3.conf
  2. 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


  3. Please use the below command to create a user. Here, we have used a test user.

    sudo useradd test
  4. Create the mail directory for the test user.

    sudo mkdir /home/test/Maildir
  5. Assign the Mail directory permission to the created user.

    sudo chown test:test /home/test/Maildir
    sudo chmod -R 700 /home/test/Maildir
    


  6. Run below command to start dovecot service.

    # sudo service dovecot start
  7. To Connect your email client to SMTP server, you will need to configure Postfix.

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

    sud vi /etc/postfix/main.cf
  9. Add the below lines.

    # 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
  10. Restart the Postfix service.

    # sudo service postfix restart
  11. You will need to allow the below ports in your firewall.

    110,143,465,587,993,995
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to insall Magento 2.3.3 in cPanel?

System Requirement :   Operating System: Centos, Debian, Ubuntu, RHCE RAM: 2 GB (Require for...

How to install/add Softaculous in Plesk?

Softaculous is software that auto-install web applications with one click. There is a wide range...

How to run ClamAV and Maldet together on cPanel server?

You may be familiar with ClamAV and Maldet scanner (aka Linux Malware Detect). They're widely...

Can I upgrade my VPS plan without losing any data or settings?

Yes, you can upgrade your existing VPS to higher plan anytime. Your data will remain intact. We...

How to install Virtualmin/Webmin control panel in CentOS 7?

Before starting the installation, we need to update packages.   After Creating the VPS with...