• Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 20.04
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Dovecot (POP/IMAP) on Debian 10

Written by Rahul, Updated on June 13, 2020

Dovecot is an open-source service for IMAP and POP3 on Unix-like operating systems. It focused on lightweight and secure mail server available for most of the Linux operating system.

POP3 (Post Office Protocol 3) and IMAP (Internet Message Access Protocol) both are protocols works as message accessing agent. These protocols are used to the fetch email message from user inbox on mail servers. In simple words, POP3 and IMAP are responsible to fetch messages from mailboxes and show you on your mobile device or web interface.

This tutorial will help you to install and configure Dovecot service on Debian 10 system.

Prerequisites

  • A running Debian 10 system
  • Pre-configured mail server and user Mailboxes
  • Shell access with root or sudo privileged account

Step 1 – Install Dovecot on Debian

Debian based systems have separate packages of Dovecot for IMAP and POP3 protocols. To install Dovecot server with the POP3 and IMAP functions support, run the following command:

sudo apt install dovecot-imapd dovecot-pop3d

You can also install various Dovecot modules like, MySQL and PostgreSQL database support, mail filtering, full text search, spam filter training and ldap directory. To install additional modules run:

sudo apt install dovecot-sieve dovecot-solr dovecot-antispam

Step 2 – Dovecot Basic Settings

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.

  1. Enable Protocols: By default Dovecot has enabled POP3 and IMAP protocols in main configuration file. You can edit main configuration file and see:
    sudo nano /etc/dovecot/dovecot.conf
    
    !include_try /usr/share/dovecot/protocols.d/*.protocol
    
  2. Listen Interface: By default Dovecot listen on all interfaces including IPV6. But if you need to restrict them to specific interface edit:
    sudo nano /etc/dovecot/dovecot.conf
    
    listen = *, ::
    

    Change “*” with the interface IP like “192.168.1.10”

  3. Authentication: Then edit the authentication file for Dovecot and update following values.
    sudo nano /etc/dovecot/conf.d/10-auth.conf
    
    disable_plaintext_auth = no
    auth_mechanisms = plain login
    
  4. Setup Mailbox Directory: 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 nano /etc/dovecot/conf.d/10-mail.conf
    
    mail_location = maildir:~/Maildir
    
  5. Setup User: Next, edit below configuration file and set the username and group name of the mail server is running with.
    sudo nano /etc/dovecot/conf.d/10-master.conf
    
      unix_listener /var/spool/postfix/private/auth {
        mode = 0666
        user = postfix
        group = postfix
      }
    
  6. Setup SSL: It is an good idea to enable SSL for the Dovecot. Edit file and set SSL to yes or required. By default it uses self singed certificate, if you have your own certificates update them as followings.
    sudo nano /etc/dovecot/conf.d/10-ssl.conf
    
    ssl = yes
    
    ssl_cert = 
  7. Step 3 - Manage Dovecot Service

    We can manage dovecot using systemctl command line tool. Use the following command to enable Dovecot service.

    sudo systemctl enable dovecot.service
    

    Use the following commands to start/stop or restart Dovecot service:

    sudo systemctl start dovecot.service
    sudo systemctl stop dovecot.service
    

    Use the below command to view the current status of the service

    sudo systemctl status dovecot.service
    

    Step 4 - Test Mailbox Connection

    To test this setup, I have created an account with name "rahul" on my Debian system. The mbox setting on Postfix server is configured to ~/Maildir directory.

    Next, you need mutt command line utility to connect mailbox using imaps protocol.

    sudo apt install mutt
    

    Then connect to mailbox using below command:

    mutt -f imaps://[email protected]
    

    This will prompt to accept certificate (Press a for accept always). After that it will prompt for the password. Enter user password and press enter. You will see the emails of your account.

    Mutt IMAPs Connection

    Step 5 - Adjust FirewallD Rules

    For the systems running with firewalld need to allow following ports to allow access from network. Below is the list of port used by the POP3 and IMAP protocols:

    • IMAP - 143
    • IMAPS - 993
    • POP3 - 110
    • POP3S - 995

    To add the firewall rules, execute the following commands:

    sudo firewall-cmd --add-service={pop3,imap} --permanent
    sudo firewall-cmd --add-service={pop3s,imaps} --permanent
    

    Then reload the changes.

    sudo firewall-cmd --reload
    

    Conclusion

    In this tutorial, you have learned to install and configure Dovecot server on Debian 10 system. You have configured your server to access user mailbox via POP3 or IMAP protocols.

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

2 Comments

  1. Avatar Cameron Reply
    October 17, 2020 at 4:04 am

    BTW in your comment form, the giant SUBMIT button covers the CAPTCHA.

  2. Avatar Cameron Reply
    October 17, 2020 at 4:01 am

    This is really interesting. I’m able to connect from the local machine with imap, but when I connect from home with Thunderbird it fails to authenticate. Any clues to how to turn on more debug logging so I can find out why it doesn’t authenticate? Hard to believe the current Thunderbird is broken.

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Debian 10
  • Download Ubuntu 20.04 LTS – DVD ISO Images
  • Linux Run Commands As Another User
  • How to Check PHP Version (Apache/Nginx/CLI)
  • How To Install and Configure GitLab on Ubuntu 20.04
  • How to Install PyCharm on Ubuntu 20.04
  • How to Check Ubuntu Version with Command or Script
  • How to Set all directories to 755 And all files to 644
© 2013-2021 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy