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.
echo "WITHOUT_X11=yes" >> /etc/make.conf
echo "NO_X=yes" >> /etc/make.conf
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.
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
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.
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.
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.
ln -s /var/qmail/supervise/courier-passwd /service/courier-passwd
And let’s see if things are running.
svstat /service/courier-passwd/ /service/courier-passwd/log/
You should get an output like below
/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.
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.
vi /usr/local/etc/authlib/authdaemonrc
authmodulelist="authuserdb authvchkpw authpam authldap authmysql authpgsql"
And change it so it only says authmodulelist="authvchkpw"
authmodulelist="authvchkpw"
Let’s set up the courier authdaemond service so we can run it via daemontools.
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.
ln -s /var/qmail/supervise/courier-authdaemond /service/courier-authdaemond
And let’s see if things are running.
svstat /service/courier-authdaemond/ /service/courier-authdaemond/log/
You should get an output like below
/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.
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.
ln -s /var/qmail/supervise/courier-imap /service/courier-imap
And let’s see if things are running.
# svstat /service/courier-imap/ /service/courier-imap/log/
You should get an output like below
/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