[ Current Release: 3.4.1 ] for Fedora 21
Fedora 21 download
CentOS 5.11 download
Version 3.4.0 for Fedora 20 and CentOS 5.10:
Fedora 20 download
CentOS 5.10 download
Note: After a new install or update/upgrade, do not forget to download the rule files:
sa-update -D --nogpg
Since Fedora 15 systemd is used, instead of SysV initscripts, I have built this rpm package using systemd. I have also merged perl-Mail-SpamAssasin to spamassasin, so only 1 rpm package, spamassassin-3.3.2-9.i686.rpm, contains everything that is needed.
For SysVinit and systemd comparison table please see: http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
From the name SpamAssassin, I am sure, you already know what this program is all about: Spam Assassin. It is a spam killer software. Spam is unsolicited email which has become the plague of modern email system. What was once considered the killer application of the Internet, email has, at least for some people, become dreaded curse because of the enormous amount of spam that reached people's inbox.
How to solve the problem of spam? As of now, the only solution is to install anti-spam software. And SpamAssassin is considered the best anti-spam software there is available. And for some people it is unbelievable because it is free.
In this article I will describe how to install SpamAssasin in your Linux system using the distribution Fedora 16.
Although SpamAssassin is available in the Fedora 16 distribution, I prefer to build my own rpm package and install the newest version of SpamAssassin available at the software source:
I have made this rpm file available here.
I am also providing spamassassin rpm package for CentOS 5.6 which you can get here.
Note: Warren Togami Jr. provides spamassassin rpm packages for RHEL5 and RHEL6
After downloading the rpm file, we now have to install and configure SpamAssassin. For this, you need to be root:
Change to the directory that contains the rpm file and then install:
rpm -Uvh spamassassin-3.3.2-9.i686.rpm
Since I like this to be a site-wide installation, I do not want my users to change the required parameters, I have configured spamassassin with an x rather than c. You can change this by editing:
Now we will configure SpamAssassin:
Edit local.cf and this is what I have in my own configuration:
trusted_networks xxx.xxx.xxx/24 # this is your class c IP lock_method flock # if you are using NFS, do not use this required_score 5.0 # anything above 5.0 is flagged as spam report_safe 0 use_auto_whitelist 0 use_bayes 0 use_bayes_rules 0 bayes_auto_learn 0 ok_languages all ok_locales all
Edit v310.pre and uncomment:
#loadplugin Mail::SpamAssassin::Plugin::TextCat ==> loadplugin Mail::SpamAssassin::Plugin::TextCat
If an email is flagged as spam and you want to add "*****SPAM*****" in the subject line, then add this in the /etc/mail/spamassassin/local.cf:
rewrite_header Subject *****SPAM*****
Execute the following command to understand better what these configuration parameters mean and also read on some parameters you might need in your own situation.
Check if the configuration parameters are correct:
spamassassin -x -D --lint
Now that SpamAssassin has been configured correctly, how do you tell Sendmail to call SpamAssassin to scan for spam emails? You may want to use (spamass-milt) to do this. But I prefer to use procmail instead.
Edit /etc/procmailrc (create as needed, if it does not exist) and enter the following:
* < 256000
* ^X-Spam-Level: \*\*\*\*\*\*\*\*
N.B. Only email that is less than 256000 bytes in size will be filtered by SpamAssassin. And if the Spam-Level score has 8 * or more, this is definitely a spam and is discarded.
Now everything is ready. You need to start SpamAssassin:
/bin/systemctl start spamassassin.service
You may check if SpamAssassin is catching spam by executing:
spamc < sample-spam.txt
That's it. Everytime Sendmail receives an email, the email will be scanned for spam and tagged accordingly. I recommend that milter-greylist is used in conjunction with SpamAssassin. The effect is most dramatic. Now relax and sit back. You might find yourself getting lonely since there is no more spam to delete!
Updating SpamAssassin rules
sa-update is a script that updates SpamAssassin rules. Before you can use it, you need to install 2 additional perl modules: Archive::Tar and IO::Zlib:
yum install perl-Archive-Tar perl-IO-Zlib
After installing the files, execute the command (as root) to update:
sa-update -D --nogpg
Note: Fedora provides spamassassin rpm packages. So, if you use the package I provide, to avoid conflict during yum update/upgrade, I recommend that you append this line in your /etc/yum.repos.d/fedora.repo and /etc/yum.repos.d/fedora-updates.repo.
Fedora recommends always to use yum to install/remove/update/ugrade packages. So instead of using rpm to install/update spamassassin use yum instead:
yum --nogpgcheck install spamassassin-3.3.2-9.i686.rpm
yum --nogpgcheck update spamassassin-3.3.2-9.i686.rpm
Note: Starting with version 3.3.0, SpamAssassin does not include the rules files. You need to update (sa-update) the rules right after you install/upgrade to version 3.3.0 and above.
Fr. Visminlu Vicente L. Chua, S.J.