Previous TOC Next

Technical document: Linux Mail Server Howto
Chapter 5 - Installing courier-imap

Creating a courier user and group

It is recommended, although not essential, that a courier system account is created. As root do:

> groupadd courier

which will add a group courier to the system. You need to know what group id courier has been created with, so do:

> tail /etc/group

Now create the user courier and add to the group courier (that has group id [xxx]):

> adduser -g [xxx] -c "Courier IMAP" -s /sbin/nologin courier

Now we are ready to install courier-imap.

Downloading, compiling and installing courier-imap

Important: the below section must be run as a non-root user.

Exit as root, and log back in as a user. Then do:

> cd
> wget http://prdownloads.sourceforge.net/courier/courier-imap-4.3.1.tar.bz2
> bunzip2 courier-imap-4.3.1.tar.bz2
> tar -xvf courier-imap-4.3.1.tar
> cd courier-imap-4.3.1
> ./configure
> make
> make check

The compiled package can now be installed, which should (normally) be done as root:

> su
> make install-strip
> make install-configure

Assuming all those processes completed without errors, courier-imap is now installed:

/usr/lib/courier-imap/etc    - the configuration files.
/usr/lib/courier-imap/bin    - the imap daemon.
/usr/lib/courier-imap/libexec    - various scripts, including startup and shutdown

Starting and stopping courier-imap

To start the imap daemon, do:

> /usr/lib/courier-imap/libexec/imapd.rc start

To check it is running, do:

> ps ax

and there should be two entries like:

/usr/local/sbin/courierlogger -pid=/var/run/imapd.pid -start -name=imapd /usr/lib/courier-imap/libexec/couriertcpd -address=0 -maxprocs=40 -maxperip=4 -nodnslookup -noidentlookup
/usr/lib/courier-imap/libexec/couriertcpd -address=0 -maxprocs=40 -maxperip=4 -nodnslookup -noidentlookup 143 /usr/lib/courier-imap/sbin/imaplogin /usr/lib/courier-imap/bin/imapd

You can also check that the imap port (143) is open by doing:

> netstat -anp | grep 143

which should result in something like:

tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      10013/couriertcpd

The daemon can stopped by doing:

> /usr/lib/courier-imap/libexec/imapd.rc stop

We discuss starting courier-imap at boot time here.

Configuring courier-imap

The courier-imap config files are located in /usr/lib/courier-imap/etc. The main config file is imapd (and imapd-ssl for IMAP over SSL). It is unlikely you will have to make any changes to the defaults - however check that the Maildir location for system users is set correctly:

MAILDIRPATH=Maildir

An additional change you may wish to make is the maximum number of connections per IP address and the maximum total number of connections that courier-imap permits. These are defined by the MAXPERIP and MAXDAEMONS parameters. If they are not present in the config file, you may add them. By default courier-imap limits the number of connections per IP address to four, and the total number of connections to forty. This will cause issues if for example you are using Mozilla Thunderbird or have multiple computers behind a gateway.

Now that authdaemond and imapd are up and running, it's time to check some mail.

Previous: Chapter 4 - Installing authdaemond TOC Next: Chapter 6 - Accessing mail over IMAP