Installing dovecot with Sieve from Source on Red Hat 8.0

With this guide I would like to walk you through installing Dovecot with dovecot-pigeonhole from source on RHEL 8. It should work with all other Red-hat based distributions. In this guide I will assume that you are comfortable with the command line shell and editor.

I did not find and package for Red Hat 8.0 for dovecot-pigeonhole and I prefer installing from source instead of the package manager to ensure you get the latest bug and security fixes.

Preparation

We are staring installing the Development Tools

yum groupinstall development
yum install openldap-devel

If you do not need ldap, you can skip the yum install for the openldap.

If you do not have one I will create a directory for all the source.

mkdir /opt/src

Download the dovecot, this is the main page: https://www.dovecot.org/

Here how to download and extract

cd /opt/src
wget https://dovecot.org/releases/2.3/dovecot-2.3.6.tar.gz
tar zxvf dovecot-2.3.6.tar.gz

Now we donwload the dovecot-pigeonhole

cd /opt/src
wget https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.6.tar.gz
tar zxvf dovecot-2.3-pigeonhole-0.5.6.tar.gz

Configuring, Compiling and Installing

Now we are compiling the dovecot, remove –with-ldap if you do not need it.

cd /opt/src/dovecot-2.3.6
./configure --with-ldap --prefix=/opt/dovecot/dovecot-2.3.6
make
make install

cd /opt/src/dovecot-2.3-pigeonhole-0.5.6
./configure --with-dovecot=/opt/dovecot/dovecot-2.3.6/lib/dovecot
make
make install

Finalize

Create a service unit file so systemd can start and stop the server on boot and shutdown. Paste the following into the file /etc/systemd/system/dovecot-current.service.

it will be available

[Unit]
Description=Dovecot Server Daemon (compiled)
After=syslog.target network-online.target

[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/dovecot-compiled
ExecStart=/opt/dovecot/dovecot-current/sbin/dovecot -c ${DOVECOT_CONFIG}
ExecReload=/opt/dovecot/dovecot-current/usr/bin/doveadm reload
ExecStop=/opt/dovecot/dovecot-current/usr/bin/doveadm stop

[Install]
WantedBy=multi-user.target

Create the environment file (/etc/sysconfig/dovecot-compiled) . It should have the following contents:

DOVECOT_OPTIONS=""
DOVECOT_CONFIG="/opt/dovecot/etc_dovecot/dovecot/dovecot.conf"

Copy the configurations files

Configure the Server

Copy the configurations files

cp /opt/dovecot/dovecot-2.3.6/share/doc/dovecot/example-config /opt/dovecot/etc

Create the symbolic link for the actual version.

ln -s /opt/dovecot/dovecot-2.3.6 /opt/dovecot/dovecot-current

Modify the profiles, creating /etc/profile.d/dovecot.sh

export PATH=/opt/dovecot/dovecot-current/bin:/opt/dovecot/dovecot-current/libexec/dovecot:$PATH
export MANPATH=/opt/dovecot/dovecot-current/share/man:$MANPATH