How to Install Exim on CentOS 6

The default Centos package didn’t offer Exim. We’ve been using Exim for more than 10 years, love the flexibility of configuration and it can be a very strong MTA to do a lot of good stuff. We can’t find Exim on rpmforge either. Alternatively, we can use Fedora EPEL (Extra Package for Enterprise Linux)

To install Exim on Centos 6.x server, follow the step below;

1. Download EPEL rpm from Federo EPEL mirror,

x64 – http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
x32 – http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6Server/i386/epel-release-6-8.noarch.rpm

(As of 6th Nov, the version is 6-8, if you can’t find the package, can view the mirror site and search for it.

# wget "http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6Server/x86_64/epel-release-6-8.noarch.rpm"

2. Install the RPM, you will get the warning message, and it should be fine.

# rpm -i epel-release-6-8.noarch.rpm
# warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY

3. After install EPEL RPM, let’s search for exim package;

# yum search exim 

exim-doc.noarch : Documentation for the exim mail transfer agent
exim.x86_64 : The exim mail transfer agent
exim-greylist.x86_64 : Example configuration for greylisting using Exim
exim-mon.x86_64 : X11 monitor application for Exim
exim-mysql.x86_64 : MySQL lookup support for Exim
exim-pgsql.x86_64 : PostgreSQL lookup support for Exim
exim-sa.x86_64 : Exim SpamAssassin at SMTP time - d/l plugin
perl-Math-Fleximal.noarch : Integers with flexible representations
pfqueue.x86_64 : Queue manager for the Postfix and Exim mail transport agents

  Name and summary matches only, use "search all" for everything.

4. We choose to install exim-mysql package, due to we use MySQL to store user’s account.

# yum install exim-mysql 

5. By default, CentOS using Postfix as MTA. Follow is how to disable and enable exim on CentOS. First, we stop the service and disable postfix for autostart

# service postfix stop 
# chkconfig postix off 

6. Next we change the default Postfix MTA to Exim. Press “2” enter to select Exim.

# alternatives --config mta

There are 2 programs which provide 'mta'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.postfix
   2           /usr/sbin/sendmail.exim

7. Add Exim into auto-start service

# chkconfig exim on

8. Let’s fire up Exim service

# service exim start

Now you are done with Exim installation. Let’s verify is the MTA working as expected.

$ echo 'Hello, welcome to fire up exim MTA' | mail -s 'Exim testing email' 
# tail -F /var/log/exim/mainlog 

The log should tell you where is your email sending to with exim logging info.

That’s it, enjoy playing with Exim.