Guide On How To Install Courier Imap On FreeBSD

A step by step guide on how to install Courier Imap on FreeBSD

This guide is an extension of “Installing Qmail On FreeBSD”. It also assumes that you are running vpopmail.

We need to set up the environment before we start the Courier Imap installation.

As root

echo "WITHOUT_X11=yes" >> /etc/make.conf
echo "NO_X=yes" >> /etc/make.conf

As root

cd /usr/ports/lang/expect
make install clean

When Expect pops up [Screenshot] uncheck X11 support

When Tcl pops up [Screenshot] you can choose to install the manpages it really doesn’t hurt to do so. This is optional though and has no impact on functionality.

As root

cd /usr/ports/mail/courier-imap
make install clean

Be sure the following is checked [Screenshot] IPV6 and AUTH_VCHKPW.

It’s time to install Courier Password

As root

cd /usr/ports/security/courierpassd
make install clean

We will run all of this via daemontools so we need to remove the startup scripts the installation created.

As root

rm /usr/local/etc/rc.d/courier-authdaemond
rm /usr/local/etc/rc.d/courier-imap-imapd
rm /usr/local/etc/rc.d/courier-imap-imapd-ssl

You may wish to double check that no courier related services are starting up in rc.conf

Let’s set up the Courier Password service so we can run it via daemontools.

As root

cd /var/qmail/supervise
mkdir -m 1755 courier-passwd
cd courier-passwd
fetch http://www.xfiles.dk/files/qmail/courierpasswd-run
mv courierpasswd-run run
chmod 755 run
mkdir -m 755 log
cd log
fetch http://www.xfiles.dk/files/qmail/courierpasswd-log-run
mv courierpasswd-log-run run
chmod 755 run

Now let’s link the directory to daemontools.

As root

ln -s /var/qmail/supervise/courier-passwd /service/courier-passwd

And let’s see if things are running.

As root

svstat /service/courier-passwd/ /service/courier-passwd/log/

You should get an output like below

Output

/service/courier-passwd/: up (pid 33825) 4 seconds
/service/courier-passwd/log/: up (pid 33829) 1 seconds

We need to copy the sample configuration files that came with the install so that courier can use them. Now SSL is not needed but we will copy the configuration file anyway as you may want to set up Imap SSL later. We will also create a SSL Certificate for the same reasons.

As root

cd /usr/local/etc/courier-imap
cp imapd.cnf.dist imapd.cnf
cp imapd-ssl.dist imapd-ssl
/usr/local/share/courier-imap/mkimapdcert

We need to modify the authdaemon configuration file so that it will use vpopmail.

As root

vi /usr/local/etc/authlib/authdaemonrc

As root find this line

authmodulelist="authuserdb authvchkpw authpam authldap authmysql authpgsql"

And change it so it only says authmodulelist="authvchkpw"

The line should now look like this

authmodulelist="authvchkpw"

Let’s set up the courier authdaemond service so we can run it via daemontools.

As root

cd /var/qmail/supervise
mkdir -m 1755 courier-authdaemond
cd courier-authdaemond
fetch http://www.xfiles.dk/files/qmail/courierauth-run
mv courierauth-run run
chmod 755 run
mkdir -m 755 log
cd log
fetch http://www.xfiles.dk/files/qmail/courierauth-log-run
mv courierauth-log-run run
chmod 755 run

Now let’s link the directory to daemontools.

As root

ln -s /var/qmail/supervise/courier-authdaemond /service/courier-authdaemond

And let’s see if things are running.

As root

svstat /service/courier-authdaemond/ /service/courier-authdaemond/log/

You should get an output like below

Output

/service/courier-authdaemond/: up (pid 36443) 6 seconds
/service/courier-authdaemond/log/: up (pid 36449) 6 seconds

Let’s set up the courier imap service so we can run it via daemontools.

As root

cd /var/qmail/supervise
mkdir -m 1755 courier-imap
cd courier-imap
fetch http://www.xfiles.dk/files/qmail/courierimap-run
mv courierimap-run run
chmod 755 run
mkdir -m 755 log
cd log
fetch http://www.xfiles.dk/files/qmail/courierimap-log-run
mv courierimap-log-run run
chmod 755 run

Now let’s link the directory to daemontools.

As root

ln -s /var/qmail/supervise/courier-imap /service/courier-imap

And let’s see if things are running.

As root

# svstat /service/courier-imap/ /service/courier-imap/log/

You should get an output like below

Output

/service/courier-imap/: up (pid 37263) 4 seconds
/service/courier-imap/log/: up (pid 37264) 4 seconds

Guide-On-How To Install Qmail On FreeBSD  Guide On How To Install Squirrelmail On FreeBSD  Guide On How To Install Roundcube On FreeBSD

Official Courier Imap Site