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/
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 make install
After installation, the following SpamAssassin binaries should be located in /usr/local/bin
sa-compile sa-learn sa-update spamassassin spamc spamd
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
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.
To see the help page and check current version of SpamAssassin, type spamassassin -h
To expire the Bayes database, type sa-learn --force-expire
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 quit
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.
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.
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. :-)
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/
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.