Installing SpamAssassin is very straight forward. It does however have dependancies. Just like with amavisd-new, we can take care of these with the perl CPAN interface. First of all, lets start up the CPAN shell and get all the prerequisites installed.
enter the CPAN shell with :
Then we install the following packages. Remember to let it install and sub-dependancies by hitting enter when asked.
Now that the ground work is done, we need to get the latest source from http://spamassassin.apache.org/. When we build SpamAssassin it will ask for an email address to be used in suspected-spam reports. You may enter any email you like, though I would suggest you use your postmaster account.
Expand the archive and build SpamAssassin using the following commands :
sudo make install
Now that it is installed, we need to configure it. SpamAssassin has placed all its configuration files in
/etc/mail/spamassassin/. By default there are 6 files in there, and each one is read in turn. Because we have not installed the Razor2 program the help SpamAssassin we have to disable the code that calls it.
Open the file
/etc/mail/spamassassin/v310.pre and comment out line 32.
Now that that is done, the last thing to do is to get the spam rules for SpamAssassin to use. That is a single command :
This will fetch and install a bunch of spam rules for SpamAssassin to work with. You can add your own rules, and you can train SpamAssassin for ham and spam as well. Please see the SpamAssassin documentation for more details.