#### Beyond Linux® From Scratch (System V Edition) - Version 12.3

### Chapter 21. Mail Server Software

- Prev

  Mail Server Software

- Next

  Exim-4.98.1

- Up
- Home

# Dovecot-2.4.0

## Introduction to Dovecot

Dovecot is an Internet Message Access Protocol (IMAP) and Post Office Protocol (POP) server, written primarily with security in mind. Dovecot aims to be lightweight, fast and easy to set up as well as highly configurable and easily extensible with plugins.

This package is known to build and work properly using an LFS 12.3 platform.

### Package Information

- Download (HTTP): https://www.dovecot.org/releases/2.4/dovecot-2.4.0.tar.gz

- Download MD5 sum: 5a0b3aaaf0adc1278d2611ff5f1593cd

- Download size: 7.5 MB

- Estimated disk space required: 253 MB

- Estimated build time: 4.8 SBU

### Dovecot Dependencies

#### Required

libtirpc-1.3.6 and Linux-PAM-1.7.0

#### Optional

Cyrus SASL-2.1.28, ICU-76.1, libcap-2.73 with PAM, libunwind-1.8.1, Lua-5.4.7, MariaDB-11.4.5 or MySQL, OpenLDAP-2.6.9, PostgreSQL-17.4, SQLite-3.49.1, Valgrind-3.24.0, xapian-1.4.27, xfsprogs-6.13.0, Cassandra, stemmer and libsodium

## Installation of Dovecot

### Warning

There are significant changes in the configuration of this package that are required when updating to Dovecot 2.4.0. Please review the documentation at Dovecot Upgrade Guide before continuing if you are upgrading this package from a previous version.

There should be dedicated users and groups for unprivileged Dovecot processes and for processing users' logins. Issue the following commands as the `root` user:

    groupadd -g 42 dovecot &&
    useradd -c "Dovecot unprivileged user" -d /dev/null -u 42 \
            -g dovecot -s /bin/false dovecot &&
    groupadd -g 43 dovenull &&
    useradd -c "Dovecot login user" -d /dev/null -u 43 \
            -g dovenull -s /bin/false dovenull

Install Dovecot by running the following commands:

    ./configure --prefix=/usr                          \
                --sysconfdir=/etc                      \
                --localstatedir=/var                   \
                --with-systemd=no                      \
                --with-lua=no                          \
                --docdir=/usr/share/doc/dovecot-2.4.0  \
                --disable-static &&
    make

To test the results, issue make -k check.

Now, as the `root` user:

    make install

## Command Explanations

`--disable-static`: This switch prevents installation of static versions of the libraries.

`--with-ldap`: This switch enables OpenLDAP authentication support.

`--with-pgsql`: This switch enables PostgreSQL database support.

`--with-mysql`: This switch enables MySQL database support.

`--with-sqlite`: This switch enables SQLite database support.

`--with-lua=no`: This switch enables Lua plugin support. This includes a mail and push notification plugin. The support is currently broken with Lua 5.4.

## Configuring Dovecot

### Config Files

`/etc/dovecot/dovecot.conf`

### Configuration Information

The following configuration is a simple proof of concept with IMAP service using local users for authentication and mailbox location.

    mv -v /etc/dovecot/dovecot.conf{,.orig} &&
    chmod -v 1777 /var/mail &&
    cat > /etc/dovecot/dovecot.conf << "EOF"

    # The dovecot configuration requires a minimum version to be set. The server
    # will refuse to start if the version set here is older than the version of
    # Dovecot installed. This option allows the Dovecot server to set reasonable
    # default values based on what version is set here.
    dovecot_config_version = 2.4.0

    # This option sets the minimum version that is able to read data files from
    # the Dovecot server. This is primarily for a cluster which may have several
    # different versions of Dovecot installed, but is required for the server to
    # run.
    dovecot_storage_version = 2.4.0

    protocols = imap
    ssl = no
    # The next line is only needed if you have no IPv6 network interfaces
    listen = *
    mail_inbox_path = /var/mail/%{user}
    mail_driver = mbox
    mail_path = ~/Mail
    userdb users {
      driver = passwd
    }
    passdb passwords {
      driver = pam
    }
    EOF

The above configuration also requires a configuration file to be installed for Linux-PAM so dovecot can authenticate users. Issue the following command as the `root` user to create the configuration file for Linux-PAM:

    cat > /etc/pam.d/dovecot << "EOF"
    # Begin /etc/pam.d/dovecot

    auth     include system-auth
    account  include system-account
    password include system-password

    # End /etc/pam.d/dovecot
    EOF

You will definitely want to read the official documentation at https://doc.dovecot.org/2.4.0/ if you plan to use Dovecot in a production environment.

### Boot Script

If you want the Dovecot server to start automatically when the system is booted, install the `/etc/rc.d/init.d/dovecot` init script included in the blfs-bootscripts-20250225 package.

    make install-dovecot

## Contents

Installed Programs: doveadm, doveconf, dovecot, and dovecot-sysreport
Installed Libraries: various internal plugins in `/usr/lib/dovecot`
Installed Directories: /etc/dovecot, /usr/{include,lib,libexec,share}/dovecot and /usr/share/doc/dovecot-2.4.0

### Short Descriptions

doveadm | is the Dovecot administration tool
doveconf | is Dovecot's configuration dumping utility
dovecot | is the IMAP and POP server
dovecot-sysreport | prints system information that is useful to the Dovecot developers when submitting bug reports upstream

- Prev

  Mail Server Software

- Next

  Exim-4.98.1

- Up
- Home