Thursday, September 25, 2008

Install Exim with DKIM and Domainkeys on DirectAdmin

Installing Exim on DirectAdmin makes my day today. I have to dig several sites in order to finish the installation. I think It will be better to document it here. I may need it again in the future, or perhaps you may need this when you need to compile Exim with DKIM and domainkeys on Centos.

First, compile and install the DKIM:
wget http://duncanthrax.net/exim-experimental/libdkim-1.0.16-tk.tar.gz
tar zxvf libdkim-1.0.16-tk.tar.gz
cd libdkim-1.0.16-tk
cd src
make
make install
cd ..
cp lib/libdkim.a /usr/lib
cp include/dkim.h /usr/include/
Compline and Install Domainkeys:
tar zxvf libdomainkeys-0.69.tar.gz
cd libdomainkeys-0.69
make
echo -lresolv > dns.lib
make
make install
cp *.h /usr/local/include/
cp *.a /usr/local/lib
Download Exim:
wget http://files.directadmin.com/services/all/exim/exim-4.69.tar.gz
tar xvzf exim-4.69.tar.gz
cd exim-4.69/Local
wget http://www.directadmin.com/Makefile
perl -pi -e 's/^EXTRALIBS/#EXTRALIBS/' Makefile
Edit the Makefile:
EXPERIMENTAL_DKIM=yes
CFLAGS  += -I/usr/include
LDFLAGS += -ldkim -lssl -lstdc++ -L/usr/lib
EXPERIMENTAL_DOMAINKEYS=yes
CFLAGS  += -I/usr/local/include
LDFLAGS += -ldomainkeys -L/usr/local/lib
#added April 9, 2008
HAVE_ICONV=yes
CFLAGS=-O -I/usr/local/include
EXTRALIBS_EXIM=-L/usr/local/lib -liconv
#end add
Compile and Install it:
cd ..
make
make install
Last job, you need to rename the compiled exim and restart:
cp -f /usr/sbin/exim-4.69-12 /usr/sbin/exim
/sbin/service restart exim
That's it, you have exim with domainkeys on DirectAdmin now.