Welcome to Linux Support and Sun Help
Search LinuxSupport

Exim is available from www.exim.org

If you're integrating with SpamAssassin and sa-exim, view and follow the SpamAssassin instructions before you continue installing Exim.

To download and uncompress Exim,

wget ftp://ftp.exim.org/pub/exim/exim4/exim-4.67.tar.gz
gunzip exim-4.67.tar.gz
tar -xvf exim-4.67.tar
cd exim-4.67

Before you can compile Exim you need to configure the main Make file with paramaters suitable for your own installation and server. Start by copying the default makefile supplied with Exim, then edit it accordingly:-

cp src/EDITME Local/Makefile
vi Local/Makefile
  • Confirm BIN_DIRECTORY=/usr/exim/bin
  • Confirm EXIM_USER=exim
  • Comment out the EXIM_MONITOR=eximon.bin line.
  • Uncomment the WITH_CONTENT_SCAN=yes line.

Save and exit vi.

Ensure that you've copied the relevant files from sa-exim, if you're using SpamAssassin.

Before you compile Exim, you need to make sure you've got an exim user on your system, as we're going to be compiling Exim to run under it's own user (EXIM_USER in configuration above). If there is such a user, you're now ready to compile....

make install
Testing and Running Exim

You can test the exim configuration by typing

/usr/exim/bin/exim -C /usr/exim/configure -bV

If everything is ok, you can run exim by typing

/usr/exim/bin/exim -bd -q1h

The -bd parameter will tell Exim to run in the background and the -q1h parameter will use a queue of 1 hour.

You may want to add this to your /etc/rc.d/rc.local file if you want Exim to automatically start each time you boot your server.

Replacing Sendmail with Exim

One of the purposes of running Exim is to replace Sendmail, so you'll need to ensure that your server calls Exim in place of Sendmail. This requires moving/archiving the original Sendmail binary and sym-linking exim in it's place.

Sendmail is usually located at /usr/sbin/sendmail

Rename your existing Sendmail (so you've still got it in case something goes wrong) via

mv /usr/sbin/sendmail /usr/sbin/sendmail.old

You now need to create a symlink to restore sendmail but point it to exim instead. This is done via the following command:-

ln -s /usr/exim/bin/exim /usr/sbin/sendmail

The two filenames in the ln -s command are in the form ln -s <target> <newfile> where <target> is the name of the file you wish to link to and <newfile> is the name of the new file you wish to create. This will be the synlink.

Exim will now be called in place of Sendmail and is pretty much an exact replacement - but easier to configure! :-)

Configuring Exim

If you have multiple email domains being hosted, it makes sense to configure Exim to use a separate email alias file for each hosted domain. This requires some additional configuration files to be created. I generally create these inside /usr/exim/ and create two new directories called 'aliases' and 'config'.

The /usr/exim/aliases directory will contain the various alias files for each hosted mail domain and the /usr/exim/config directory will contain two files, 'domains' and 'relay'.

/usr/exim/config/domains contains a list of domains being hosted

/usr/exim/config/relay contains a list of machines allowed to relay through your mail server.

You then need to amend the main Exim configure file (/usr/exim/configure) in order to use the additional files:-

Find the domainlist lines (just below the primary_hostname and amend them to use the additional config files.

domainlist local_domains = lsearch;/usr/exim/config/domains
domainlist relay_to_domains = lsearch;/usr/exim/config/relay
hostlist   relay_from_hosts = : 10.1.1.x

where x is any other local machine which you may want to relay

I also implement host blacklisting for known spam sources. To do this, I've added the following line.

# Define local blacklists for blocking certain originating domains
hostlist   blacklist_hosts = : : : 61.5.
64.0/22 : : : : : 68.
118.48.0/20 : : : : : 80
.96.64.0/19 : : : : : : : : : 
: : : : : 125.224.0.
0/13 : : : : : 19 : : : :
24 : : : : : 202.136
.0.0/16 : : : : 
: : : : : 219.94.4
8.0/20 : : : : : 221.
206.0.0/14 : : : : : 2

Uncomment the spamd_address line if you're using SpamAssassin.

spamd_address = 783

Add a section on client aliases (ie. to search the list of alias files in the file you created above) just after the system_aliases section.

  driver = redirect
  data = ${lookup{$local_part}lsearch*{/usr/exim/aliases/aliases.$domain}}
Valid HTML 4.01! Valid CSS!