User Tools

Site Tools


archive:freebsd_install_dovecot

How To Install Dovecot On FreeBSD

Installing Dovecot

Dovecot is an open-source IMAP, IMAP-SSL and POP3 server. You don't need to use Dovecut you could use Courier Imap instead but Dovecut does a pretty good job. This guide only covers the configuration of Dovecut with IMAP-SSL and Managesieve.

cd /usr/ports/mail/dovecot
make WITH="VPOPMAIL" install clean BATCH=yes

When the option screen pops up just hit ok.

Running Dovecot with Daemontools

cd /usr/local/etc
mv dovecot.conf dovecot.orig
fetch http://www.xfiles.dk/content/files/freebsd-qmail/dovecot.tar.gz
tar zxvfp dovecot.tar.gz
rm dovecot.tar.gz
mkdir /var/qmail/supervise/dovecot/log
cd /var/qmail/supervise/dovecot/log
fetch http://www.xfiles.dk/content/files/freebsd-qmail/dovecot-log-run
mv dovecot-log-run run
chmod 0755 run
cd /var/qmail/supervise/dovecot/
fetch http://www.xfiles.dk/content/files/freebsd-qmail/dovecot-run
mv dovecot-run run
chmod 0755 run

Enable the service

ln -s /var/qmail/supervise/dovecot /service/

And check if things are working as intended.

svstat /service/dovecot /service/dovecot/log

You should get an output very similar to the one below.

/service/dovecot: up (pid 686) 27 seconds
/service/dovecot/log: up (pid 695) 27 seconds

Adding Dovecot to qmailctl

vi /usr/bin/qmailctl

Find the following lines and remove the # in front of all of them.

# if svok /service/dovecot ; then
# svc -u /service/dovecot /service/dovecot/log
# echo "Starting dovecot"
# else
# echo "dovecot supervise not running"
# fi

# echo " dovecot"
# svc -d /service/dovecot /service/dovecot/log

# svstat /service/dovecot
# svstat /service/dovecot/log

# echo "Pausing dovecot"
# svc -p /service/dovecot

# echo "Pausing dovecot"
# svc -c /service/dovecot

# echo "* Restarting dovecot"
# svc -t /service/dovecot /service/dovecot/log

All of the above lines should look like this.

if svok /service/dovecot ; then
svc -u /service/dovecot /service/dovecot/log
echo "Starting dovecot"
else
echo "dovecot supervise not running"
fi

echo " dovecot"
svc -d /service/dovecot /service/dovecot/log

svstat /service/dovecot
svstat /service/dovecot/log

echo "Pausing dovecot"
svc -p /service/dovecot

echo "Pausing dovecot"
svc -c /service/dovecot

echo "* Restarting dovecot"
svc -t /service/dovecot /service/dovecot/log

Adding SSL to Dovecot

In order to add ssl functionality to Dovecot you need 2 things.

  1. Having qmail SSL configured see this guide Configuring Qmail SSL
  2. Enable SSL in the dovecot configuration file.

Enable SSL in the dovecot configuration file.

vi /usr/local/etc/dovecot.conf

Find this line.

ssl = no

And change it to yes like this.

ssl = yes

Finally restart Dovecot and check if it is running as intended.

svc -t /service/dovecot /service/dovecot/log
qmailctl stat
archive/freebsd_install_dovecot.txt · Last modified: 24/11/2023 12:33 by Allan