Welcome to Linux Support and Sun Help
Search LinuxSupport

If you're using Exim then it's probably advisable to also install sa-exim at the same time. This is a patch which allows exim to reject spam at SMTP time, and needs to be compiled into exim. More later.

SpamAssassin is available to download from http://spamassassin.apache.org/

wget http://mirror.fubra.com/ftp.apache.org/spamassassin/source/Mail-SpamAssassin-3.2.2.tar.gz
Compiling SpamAssassin

It's probably advisable to build SpamAssassin first. The first time you install SpamAssassin, it's probably best to compile from sources rather than to install via CPAN because in my experience I've found that an initial install via CPAN can give various problems, depending upon dependencies required.

Decompress, compile and install SpamAssassin via the following commands:-

gzunip Mail-SpamAssassin-3.2.2.tar.gz
tar -xvf Mail-SpamAssassin-3.2.2.tar
cd Mail-SpamAssassin-3.2.2
perl Makefile.pl
make install
Location of binaries

After installation, the following SpamAssassin binaries should be located in /usr/local/bin


To test SpamAssassin, type spamassassin -D --lint

This will produce quite a lengthy output, providing the results from various tests and checks.

or to find the version, type spamassassin -V

Updating Spam Rules

If you're running SpamAssassin 3.1.1 or later, you should be able to run sa-update as the root user and new rules will be downloaded and installed. See wiki.apache.org/spamassassin/RuleUpdates for the official notes on RuleUpdates.

Miscellaneous SpamAssassin tips

To see the help page and check current version of SpamAssassin, type spamassassin -h

To expire the Bayes database, type sa-learn --force-expire

Updating SpamAssassin via CPAN

You can use CPAN to update SpamAssassin, but in my experience it can sometimes cause problems to install in the first place via CPAN. Therefore I tend to install from source but run future updates via CPAN.

To update SpamAssassin via CPAN, run the following commands:-

perl -MCPAN -e shell
install Mail::SpamAssassin
reload CPAN

At the install stage, watch the output to see if any further dependencies need to be installed as well. This process can take a little while, depending upon how out of date your system is.

Links for further information on SpamAssassin
Setting up sa-exim for Exim

sa-exim, from marc.merlins.org/linux/exim/sa.html will allow you to reject spam messages at SMTP time and it can be integrated into Exim reasonably painlessly.

wget http://marc.merlins.org/linux/exim/files/sa-exim-current.tar.gz

sa-exim has to be merged with the Exim source code, which means that you'll probably need to recompile Exim after configuring sa-exim. I've found this whole exercise quite confusing, so improvements to these notes would be appreciated. :-)

Unpack sa-exim:-

gunzip sa-exim-current.tar.gz
tar -xvf sa-exim-current.tar
cd sa-exim-current

You now need to edit the sa-exim.c file to ensure that the relevant configuration file is pointing to the correct place. I generally put this in the same directory as the main Exim configuration file, namely in /etc/exim/

vi sa-exim.c

Locate the line that contains #define SPAMASSASSIN_CONF and change to /usr/exim/sa-exim.conf

Save and exit vi. Then copy this file into the Exim source directory, overwriting local_scan.c

cp sa-exim.c ../exim-4.67/src/local_scan.c

Now make the header file and copy into Exim too:-

make sa-exim.h
cp sa-exim.h ../exim-4.67/src/

You should now go back into the Exim directory (cd ../exim-4.67/) and recompile.

N.B. These instructions assume you're using Exim 4.67. For other versions, substitute the appropriate version number in the filenames above.

Links for further information on sa-exim
Valid HTML 4.01! Valid CSS!