Installing Spamassassin on Ubuntu 14.04 Server
Spamassassin is a free and open-source mail filter that is used to identify spam using a wide range of tests on mail headers and body. It's very easy to use Spamassassin to protect your mailbox from spammers. The best thing is that we can create rules by ourselves and manage it. Here is how you can install it on your Ubuntu 14.04 server
Before installing Spamassassin, make sure you already have a MTA such as Postfix (or Axigen) installed on your server.
Install Spamassassin
apt-get install spamassassin spamc
To run Spamassassin you need to create a new group and user with the home directory /var/log/spamassassin, create the users home directory and change the ownership to the new user:
groupadd spamd useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd mkdir /var/log/spamassassin chown spamd:spamd /var/log/spamassassin
Setting Up Spamassassin
Open the spamassassin config file (/etc/default/spamassassin) To enable Spamassassin find the line
ENABLED=0
and change it to
ENABLED=1
To enable automatic rule updates in order to get the latest spam filtering rules find the line
CRON=0
and change it to
CRON=1
Add a variable named SAHOME with the Spamassassin home directory:
SAHOME="/var/log/spamassassin/"
Find and change the OPTIONS variable to
OPTIONS="--create-prefs --max-children 2 --username spamd -H ${SAHOME} -s ${SAHOME}spamd.log"
This specifies the username Spamassassin will run under, as well as add the home directory, create the log file, and limit the child processes that Spamassassin can run. If you have a high traffic server, you can increase the max-children value.
Start the Spamassassin daemon by using the following code:
service spamassassin start