Installing Dovecot as the IMAP/POP3 server and MDA: installing the dovecot-imapd, dovecot-pop3d, and dovecot-lmtpd packages, understanding the configuration structure in /etc/dovecot, basic parameters like protocols, listen, mail_location, and auth_mechanisms, plus verification via doveconf -n.

Postfix stood up in episode 3 as the message carrier. Now it's its partner's turn: Dovecot, which will store email in mailboxes, serve reads via IMAP/POP3, and later act as the MDA via LMTP.
This episode builds Dovecot's foundation: package installation, the configuration directory structure, basic parameters, and how to verify the configuration with doveconf -n. By the end of the episode, you'll be able to log in to Dovecot and watch the Maildir structure start to form.
Dovecot is distributed as several separate packages so that only the features you need are installed. For our lab, install all three at once:
sudo apt install -y dovecot-imapd dovecot-pop3d dovecot-lmtpddovecot-imapd — serves IMAP and IMAPS for mailbox reads.dovecot-pop3d — serves POP3 and POP3S for clients that download email.dovecot-lmtpd — provides the LMTP protocol, which Postfix will use to deliver messages in episode 9.Verify the installed version:
dovecot --versionOn the latest 2026 distributions, the result is 2.4.4 — Dovecot CE generation 2.4 with a new configuration structure we'll dissect in episode 21.
Dovecot's configuration is spread across /etc/dovecot/:
dovecot.conf — the main file that includes the other parts.conf.d/ — contains separate configuration modules: 10-mail.conf, 10-auth.conf, 10-ssl.conf, 20-imap.conf, 20-lmtp.conf, and so on.dovecot-sql.conf.ext — the template for database-backed auth configuration (episode 7).Info
On Dovecot 2.3 and earlier, the configuration used variables like %u for users. Since Dovecot 2.4 (2025), the variable system was completely overhauled with a new %{var} syntax. If old tutorials feel strange compared to 2.4 configuration, that's why — episode 21 explains the migration.
Defines which services are enabled:
protocols = imap pop3 lmtpThe interfaces Dovecot listens on. The value * means all IPv4, :: for IPv6, and [::] for both. For a public mail server, listen = * is enough — webmail services don't need to open IMAP ports to the public (episode 16).
The most decisive parameter: where and how mailboxes are stored. For Maildir (episode 9):
mail_location = maildir:~/MaildirThe ~ sign refers to the user's home directory. For virtual users later, we'll use a different format with %{user}.
The authentication mechanisms offered. For now plain login is enough:
auth_mechanisms = plain loginOther mechanisms like cram-md5 and scram-sha-256 are discussed in episode 13.
Dovecot provides doveconf to display the active configuration — the equivalent of Postfix's postconf. The two most useful variants:
doveconf -n
doveconf protocols mail_locationdoveconf -n shows only non-default settings (the combined result of all files), while the second line shows the active values of two specific parameters. Before restarting, always run a syntax check:
doveconf -n > /dev/nullIf there are no errors, the configuration is valid. Restart the service with systemd:
sudo systemctl restart dovecot
systemctl status dovecot --no-pagerIn episode 3, Postfix delivered local email to the system mailbox. To use Dovecot as the storage location while also serving IMAP, two things must be aligned:
For now, run a basic test with a system user:
telnet localhost 143At the prompt, log in with a LOGIN devnull secret — replace with your Linux user and password. If successful, Dovecot replies a OK. Type a LOGOUT to exit. You'll later replace this telnet connection with safer IMAP testing in episodes 13 and 16.
Episode 4 is done. Key takeaways:
dovecot-imapd, dovecot-pop3d, and dovecot-lmtpd all together.dovecot.conf and conf.d/; don't hesitate to use separate files.protocols, listen, mail_location, and auth_mechanisms are the core parameters.doveconf -n shows the active configuration and validates syntax.mail_location = maildir:~/Maildir is the start of your mailbox structure.Postfix and Dovecot now stand side by side. In episode 5 we connect both to the outside world: DNS — MX, SPF, DKIM, and DMARC — the four records that determine whether your email is accepted, rejected, or lands in spam. See you in episode 5!