Welcome to Linux Support and Sun Help
Search Sun Help

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
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 = 127.0.0.1 : 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 = 58.9.0.0/16 : 58.69.128.0/17 : 58.68.0.0/17 : 61.5.
64.0/22 : 61.95.128.0/17 : 61.134.0.0/18 : 62.101.160.0/19 : 66.214.0.0/15 : 68.
118.48.0/20 : 68.160.192.0/15 : 71.96.0.0/11 : 72.128.0.0/13 : 80.48.0.0/13 : 80
.96.64.0/19 : 81.3.128.0/18 : 82.114.80.0/24 : 82.201.224.0/19 : 82.224.0.0/11 :
 84.252.0.0/16 : 85.48.0.0/12 : 85.240.0.0/13 : 87.196.120.0/17 : 87.206.0.0/16 
: 87.219.0.0/16 : 88.229.128.0/17 : 121.55.64.0/17 : 124.248.0.0/16 : 125.224.0.
0/13 : 194.54.32.0/19 : 195.112.96.0/19 : 195.239.0.0/16 : 196.204.227.0/24 : 19
9.190.202.0/24 : 200.97.0.0/16 : 200.181.0.0/16 : 200.226.0.0/17 : 201.28.219.0/
24 : 201.78.0.0/15 : 201.208.0.0/14 : 201.240.99.0/25 : 202.215.0.0/16 : 202.136
.0.0/16 : 202.188.165.192/27 : 203.87.128.0/17 : 203.197.0.0/16 : 210.93.0.0/14 
: 210.213.244.0/19 : 213.132.80.0/23 : 218.78.0.0/15 : 218.252.0.0/14 : 219.94.4
8.0/20 : 219.146.0.0/15 : 220.72.0.0/12 : 221.133.0.0/16 : 221.196.0.0/15 : 221.
206.0.0/14 : 221.208.0.0/14 : 222.0.0.0/12 : 222.208.0.0/13 : 222.232.0.0/13 : 2
22.252.0.0/14

Uncomment the spamd_address line if you're using SpamAssassin.

spamd_address = 127.0.0.1 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.

client_aliases:
  driver = redirect
  allow_defer
  allow_fail
  data = ${lookup{$local_part}lsearch*{/usr/exim/aliases/aliases.$domain}}
  forbid_file
  forbid_pipe
  retry_use_local_part
Valid HTML 4.01! Valid CSS!
/td>