Installing maildrop on CentOS 5

I have been in the process of migrating my websites from a couple of dedicated machines to a VPS (Virtual Private Server) which has a fairly minimal base install of CentOS 5 on it. My existing mailserver runs on Gentoo Linux, running Postfix, courier-imap, maildrop, Spamassassin and ClamAV, with the mail accounts and aliases handled by MySQL.

I would have liked to have run only packages available from the CentOS distribution (plus the addons etc) but neither courier-imap nor maildrop are available in the CentOS package trees. Instead I would need to use either cyrus-imapd or dovecot and maildrop was not available at all.

After spending several hours looking at the possible setups, I couldn’t seem to find anyone who had done more or less exactly what I wanted to do on a CentOS server; ie mail filtering through anti-spam and anti-virus software, and then further filtering into specific imap directories. The SMTP and POP/IMAP servers seem to work fine with MySQL, and I found plenty of howtos to integrate them with anti-spam and anti-virus software (although on other distros, and with amavisd which is not available in the CentOS packages), so I was drawing a bit of a blank.

So finally, I have decided to go ahead and install maildrop myself using the source files, which contain the necessary stuff to build an RPM and then install it. I will write up another post later once I have the full mail server installed but this will do for now, to cover installing maildrop on CentOS 5.

First of all, you need to download the latest version of maildrop from Sourceforge. The version I used was 2.0.4 as you will see in the examples below. Note that using $EDITOR will use whatever your environment has defined as your text editor; it’s possible it may not be defined. You can substitute it for your favourite editor, such as nano or vi.


cd ~/temp
mkdir rpmbuild
mkdir rpmbuild/BUILD rpmbuild/RPMS rpmbuild/SOURCES rpmbuild/SPECS rpmbuild/SRPMS
mkdir rpmbuild/RPMS/i386 rpmbuild/RPMS/i586 rpmbuild/RPMS/i686
mkdir rpmbuild/SRPMS/i386 rpmbuild/SRPMS/i586 rpmbuild/SRPMS/i686
$EDITOR ~/.rpmmacros
At this stage you need to enter the text below into your editor and then save. (I’m not sure if this is required or not, but it was in the instructions I was following).

%_topdir        %(echo $HOME)/temp/rpmbuild
%debug_package  %{nil}

Now we continue…


cd rpmbuild/SOURCES
wget http://switch.dl.sourceforge.net/sourceforge/courier/maildrop-2.0.4.tar.bz2
rpmbuild -ta maildrop-2.0.4.tar.bz2
At this stage I got some dependency error messages. You may get different ones, or none at all. It will simply be a case of installing the missing dependencies.


error: Failed build dependencies:
/usr/include/fam.h is needed by maildrop-2.0.4-1.i386
gdbm-devel is needed by maildrop-2.0.4-1.i386
pcre-devel is needed by maildrop-2.0.4-1.i386
In my case I needed to install gamin-devel (which provides fam.h), gdbm-devel and pcre-devel like so:


sudo yum install gamin-devel gdbm-devel pcre-devel
So we try again:


rpmbuild -ta maildrop-2.0.4.tar.bz2
It takes a little while to build the RPM files, but once they are created they are located in ~/temp/rpmbuild/RPMS/i386. A quick directory listing will show something along the lines of this:

-rw-rw-r-- 1 chris chris 312609 Oct 18 23:47 maildrop-2.0.4-1.i386.rpm
-rw-rw-r-- 1 chris chris 208302 Oct 18 23:47 maildrop-devel-2.0.4-1.i386.rpm
-rw-rw-r-- 1 chris chris  58242 Oct 18 23:47 maildrop-man-2.0.4-1.i386.rpm

So now it’s just a matter of changing to ~/temp/rpmbuild/RPMS/i386 and installing the files like shown below. I didn’t bother to install the development RPM as there didn’t seem much point. I can always install it later if required.


sudo rpm -ivh maildrop-2.0.4-1.i386.rpm maildrop-man-2.0.4-1.i386.rpm
Now that the RPM is installed, the following files have been installed:

maildrop
/usr/bin/deliverquota
/usr/bin/lockmail
/usr/bin/mailbot
/usr/bin/maildirmake
/usr/bin/maildrop
/usr/bin/makedat
/usr/bin/makedatprog
/usr/bin/makemime
/usr/bin/reformail
/usr/bin/reformime
/usr/share/doc/maildrop-2.0.4
/usr/share/doc/maildrop-2.0.4/COPYING
/usr/share/doc/maildrop-2.0.4/ChangeLog
/usr/share/doc/maildrop-2.0.4/INSTALL
/usr/share/doc/maildrop-2.0.4/NEWS
/usr/share/doc/maildrop-2.0.4/README
/usr/share/doc/maildrop-2.0.4/README.maildirquota.html
/usr/share/doc/maildrop-2.0.4/README.maildirquota.txt
/usr/share/doc/maildrop-2.0.4/README.postfix
/usr/share/doc/maildrop-2.0.4/UPGRADE
/usr/share/doc/maildrop-2.0.4/deliverquota.html
/usr/share/doc/maildrop-2.0.4/lockmail.html
/usr/share/doc/maildrop-2.0.4/mailbot.html
/usr/share/doc/maildrop-2.0.4/maildir.html
/usr/share/doc/maildrop-2.0.4/maildirmake.html
/usr/share/doc/maildrop-2.0.4/maildirquota.html
/usr/share/doc/maildrop-2.0.4/maildrop.html
/usr/share/doc/maildrop-2.0.4/maildropex.html
/usr/share/doc/maildrop-2.0.4/maildropfilter.html
/usr/share/doc/maildrop-2.0.4/maildropgdbm.html
/usr/share/doc/maildrop-2.0.4/maildroptips.txt
/usr/share/doc/maildrop-2.0.4/makedat.html
/usr/share/doc/maildrop-2.0.4/makemime.html
/usr/share/doc/maildrop-2.0.4/manpage.css
/usr/share/doc/maildrop-2.0.4/reformail.html
/usr/share/doc/maildrop-2.0.4/reformime.html
/usr/share/doc/maildrop-2.0.4/rfc2045.html
/usr/share/doc/maildrop-2.0.4/rfc822.html
/usr/share/maildrop

maildrop-man
/usr/share/man/man1/lockmail.1.gz
/usr/share/man/man1/mailbot.1.gz
/usr/share/man/man1/maildirmake.1.gz
/usr/share/man/man1/maildrop.1.gz
/usr/share/man/man1/makemime.1.gz
/usr/share/man/man1/reformail.1.gz
/usr/share/man/man1/reformime.1.gz
/usr/share/man/man5/maildir.5.gz
/usr/share/man/man7/maildirquota.7.gz
/usr/share/man/man7/maildropex.7.gz
/usr/share/man/man7/maildropfilter.7.gz
/usr/share/man/man7/maildropgdbm.7.gz
/usr/share/man/man8/deliverquota.8.gz

I’ll cover actually using and configuring maildrop in a later article and will provide links here to it when completed.