Wednesday, July 30, 2014

Installing dovecot with vpopmail support on Ubuntu 12.04.4 LTS

The problem is that dovecot is not compiled with --with-vpopmail support. Here is step-by-step guide how to make debian package from source.

First you need working vpopmail installed somewhere on the system. Second we need some deb packages installed for the build process:
# apt-get install build-essential dpkg-dev debhelper pkg-config libssl-dev libpam0g-dev libldap2-dev libpq-dev libmysqlclient-dev drac-dev libsasl2-dev libsqlite3-dev libbz2-dev libdb-dev libcurl4-gnutls-dev libexpat-dev hardening-wrapper
Now download the source package:
# apt-get source dovecot
This will get the source and unpack it in current directory
root@mail2:/usr/src/tmp# ls -l
drwxr-xr-x 7 root root    4096 Jul 30 10:53 dovecot-2.0.19
-rw-r--r-- 1 root root 1278258 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.debian.tar.gz
-rw-r--r-- 1 root root    3142 May 15 17:29 dovecot_2.0.19-0ubuntu2.1.dsc
-rw-r--r-- 1 root root 3357056 Apr  8  2012 dovecot_2.0.19.orig.tar.gz
Now enter dovecot directory and edit the file debian/rules. Find the lines:
$(shell dpkg-buildflags --export=configure) sh configure \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
and add another line like this:

 $(shell dpkg-buildflags --export=configure) sh configure \
                 --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Alternatively here is a patch:

--- dovecot-2.0.19/debian/rules    2012-06-29 00:33:07.000000000 +0300
+++ ../dovecot-2.0.19/debian/rules    2014-07-30 10:18:00.469643701 +0300
@@ -25,6 +25,7 @@
     dh_testdir
     # Dovecot
     $(shell dpkg-buildflags --export=configure) sh configure \
+            --with-vpopmail \
                 --with-ldap=plugin \
                 --with-ssl=openssl \
                 --with-sql=plugin \
Now go to unpacked dovecot's directory and build the package:
# dpkg-buildpackage -uc -rfakeroot
You will end up with lot of *.deb files. The one that you need is 'dovecot-core_2.0.19-0ubuntu2.1_i386.deb'. Install it, restart dovecot and use your vpopmail support.
# dpkg -i dovecot-core_2.0.19-0ubuntu2.1_i386.deb
# service dovecot restart