Guide On How To Install Dovecot On FreeBSD

Guide On How To Install Dovecot On FreeBSD 2017-08-04T09:43:57+00:00

A Step By Step Guide On How To Install Dovecot On FreeBSD
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 and has gained more and more popularity over the years. Dovecot has a tremendous amount of options and possibilities and there is simply not enough time to cover all of this. So this will just be a quick guide in order to get you up running with Dovecot. Once it runs you can then expand on your knowledge of Dovecot by yourself.

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

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.conf
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 dovecot to run with daemontools.

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

And let’s check if things are running 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

Add Dovecot to qmailctl

In order to control dovecut from qmailctl we need to edit this file /usr/bin/qmailctl find the following lines and remove the # mark.

# 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 lines above should now 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

Enabling SSL

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

1: Having qmail with SSL configured.
2: Enable SSL in the dovecot configuration file.

To Enable SSL in Dovecot edit this file /usr/local/etc/dovecot.conf If you enable SSL in Dovecot but your Qmail installation does not have SSL running then Dovecot will stop working. Dovecot does not have a “fallback” option if SSL should not be available. Right so in /usr/local/etc/dovecot.conf find this line.

ssl = no

And you guessed it. Change it to.

ssl = yes

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

svc -t /service/dovecot /service/dovecot/log
qmailctl stat

And we are done here.

Spell checkers don’t – Grammar checkers don’t either.