How to install Dovecot on Ubuntu Linux

This brief tutorial shows students and new users how to install and configure the Dovecot mail server on Ubuntu 18.04 | 16.04 servers.

For the uninitiated, Dovecot is an open-source and free mail server that focuses on security and can be installed on most Linux systems, including Ubuntu using a simple command.

Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.

When using Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.

To get started, follow the steps below:

Install Dovecot on Ubuntu

Dovecot packages are available via Ubuntu default repositories. Using a simple command, you’ll be able to install it in no time.

To get Dovecot installed, run the commands below:

sudo apt update
sudo apt install dovecot-core dovecot-pop3d dovecot-imapd

When prompted whether to accept the packages that will be downloaded and installed, type y for Yes.

Once the installation is complete, you can stop, start and enable the service using the commands below:

sudo systemctl stop dovecot
sudo systemctl start dovecot
sudo systemctl enable dovecot

Then enable command enables the service to start up automatically every time the system boots up.

Configure Dovecot

Now that Dovecot is installed, move below to learn how to configure it.

Like many other mail servers, Dovecot has many different configuration options. Some are basic while others are more advanced.

Dovecot’s main configuration file is located at /etc/dovecot/dovecot.conf.

Run the commands below to open its default configuration file:

sudo nano /etc/dovecot/dovecot.conf

Then make your changes and save the file.

#uncomment line 30
listen = *, ::

Three Dovecot configuration options are mostly configured in a live environment. Listenprotocols, and mail_location.

You use the listen to configuration option to specify the IP addresses that Dovecot can listen on. For all IPv4 addresses, use the wildcard value ( * ). IPv6 is represented as (:: )


listen = *, ::

The protocol option specifies which protocol Dovecot communicates over. Dovecot support IMAP, POP3, and a few others.


protocols = imap, pop3, pop3s, lmtp

f you like, you can enable all the above protocols or choose to enable just one or any number of them.

The mail_location option defines where mail is picked up from.

The main location can be configured at:

sudo nano /etc/dovecot/conf.d/10-mail.conf

Edit and save your changes

# At line 30: change to Maildir
mail_location = maildir:~/Maildir

Besides the configuration options above, Dovecot also comes with self-signed certificate settings that come configured on the system.

Dovecot self-signed SSL certificate file is located at /etc/dovecot/dovecot.conf.

Many other Dovecot configurations are located in the /etc/dovecot directory. Most protocols are set up in thy conf.d folder of the directory.

When connecting to the service for the first time, you will receive a warning message because they are self-signed and not CA certificates.


This post shows you how to install and configure the Dovecot mail server on Ubuntu. If you find any error above, please report it in the comment form below.

You  may also like the post below: