Kloxo – qmail – Setup DKIM for Mail Server

An easy to follow guide to install DKIM on CentOS 5.x Linux mail servers using qmailtoaster and kloxo/lxadmin. Re-posting this so that it is not lost for future setups. 5 minute guide to to help prevent outgoing emails from your email servers winding up in someone’s spam box.

cd /tmp
wget http://rogersit.net/software/linux/dkim/dkim.tgz

tar –zxf dkim.tgz

cd dkim

yum install perl-XML-Simple perl-Mail-DKIM perl-XML-Parser rpm-build openssl-devel

wget http://rogersit.net/software/linux/dkim/libdomainkeys-toaster-0.68-1.3.6.src.rpm

rpmbuild --rebuild libdomainkeys-toaster-0.68-1.3.6.src.rpm

rpm -ivh /usr/src/redhat/RPMS/i386/libdomainkeys-toaster-0.68-1.3.6.i386.rpm

mkdir /var/qmail/control/dkim

cp signconf.xml /var/qmail/control/dkim/

chown -R qmailr:qmail /var/qmail/control/dkim/

dknewkey /var/qmail/control/dkim/global.key > /var/qmail/control/dkim/public.txt

perl -pi -e 's/global.key._domainkey/dkim1/' /var/qmail/control/dkim/public.txt

qmailctl stop

mv /var/qmail/bin/qmail-remote /var/qmail/bin/qmail-remote.orig

mv qmail-remote /var/qmail/bin

chmod 777 /var/qmail/bin/qmail-remote

chown root:qmail /var/qmail/bin/qmail-remote

qmailctl start

Create a TXT record dkim._domainkey.domain on DNS server for the domain you want to set DKIM as shown in the output of the following command

cat /var/qmail/control/dkim/public.txt

DKIM setup is now finished. As soon as DNS updates, you should now be able to send emails to Yahoo.


, , , , ,


  • woodie says:

    I got stuck at command dknewkey /var/qmail/control/dkim/global.key > /var/qmail/control/dkim/public.txt

    it gave me error
    [1] 13885
    -bash: gt: command not found
    -bash: /var/qmail/control/dkim/public.txt: No such file or directory

    could you help please?

  • Jason says:

    Hi woodie,

    I believe that you missed steps

    wget http://software.atnerds.com/linux/dkim/libdomainkeys-toaster-0.68-1.3.6.src.rpm
    rpmbuild –rebuild libdomainkeys-toaster-0.68-1.3.6.src.rpm
    rpm -ivh /usr/src/redhat/RPMS/i386/libdomainkeys-toaster-0.68-1.3.6.i386.rpm

    Please do the above for dknewkey not found error.

  • woodie says:

    now it gives me error: failed to stat /tmp/dkim/.rebuild: No such file or directory
    after i ran rpmbuild –rebuild libdomainkeys-toaster-0.68-1.3.6.src.rpm

    could i give you my login details and you could see if you can sort it if possible?

    if yes, send me an email to woodie6996 (at) hotmail.c0m


  • Jason says:

    Sounds like a permissions issue with your temp directory. Look at the /temp directory permissions. If it looks okay, send me an email and I will take a look at it for you for free. Please provide the following information

    My Contact: http://www.atnerds.com/u/jrogers
    1) Username
    2) Password
    3) IP

  • Jason says:

    perl-Mail-DKIM was not installed. Not part of the CentOS repository. So I added dag wiers repo to your repo list.

    rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

    After I installed the repo, then I could install perl-MAIL-DKIM

    The other portion was an issue with my blog, the blog shows

    dknewkey /var/qmail/control/dkim/global.key ;gt /var/qmail/control/dkim/public.txt

    and not

    dknewkey /var/qmail/control/dkim/global.key > /var/qmail/control/dkim/public.txt

    I guess this is some type of html code error not transitioning the > correctly. This has been fixed above.

    You are good to go, I fully setup everything for you. Send test emails after you setup DNS dkim to check-auth@verifier.port25.com to find out if your dkim is setup correctly. It will send an auto-reply with useful info.

  • power hyip says:

    I am having this error unable to run qmail-remote how do i fix this? Please

  • smith williams says:

    I have tried the steps above and even did the steps you give if i encounter unable to run qmail remote but still emails are not been sent and i still get unable to run qmail remote.

  • Jason says:


    There are many things that it can be, see my post to Woodie above. The post “January 6, 2012 at 3:29 pm” if you want me to have a look at it and fix it for you. Must have Google Talk or Skype so we can talk to each other while I look at your server.

    More than likely, there is something going on with the qmail-remote file, but do not know until I have a look.


  • smith williams says:

    I will want you to look at the server for me. lets talk on Google Talk

  • smith williams says:

    how do i send you the details so you can check it for me?