How to Install SpamAssassin on Ubuntu/Debian

What is SpamAssassin?

SpamAssassin is free and Open-source and relies on Perl language to scan and identify email headers, subject lines, and body to keep a server from spam. It will save your mailbox from many unwanted spam emails. In this guide, we will see how to install SpamAssassin on Ubuntu 20.04 server.

Prerequisites

Before installing SpamAssassin on our system, we need to install and set up a Mail Transfer Agent (MTA) like Postfix on our server. You can find the installation guide here.

Install Spam-Assassin

Let’s start the SpamAssassin installation process by running the following apt-get command on the shell screen/terminal.

apt-get install spamassassin spamc -y

Configure SpamAssassin

Now we need to configure SpamAssassin to make it workable with the mail client. There are two configuration files that we need to configure. Note that, default configuration file locate at /etc/default/spamassain and another one locate at /etc/spamassassin/local.cf. let’s configure the default one first by running the following command and make changes.

nano /etc/default/spamassassin

Set Parameters to:

ENABLED=1
SPAM_HOME="/var/log/spamassassin/"
OPTIONS="--create-prefs --max-children 5 --username spamd --helper-home-dir /home/spamd/ -s /home/spamd/spamd.log"

Open the configuration file using any text editor. Here we will use the nano text editor.

nano /etc/spamassassin/local.cf

now remove the comment from the following options and save the configuration file by CTRL+X, Y and enter

rewrite_header Subject *****SPAM*****
report_safe 0
required_score 5.0
use_bayes 1
bayes_auto_learn 1

now test the configuration file

spamassassin --lint

Conclusion

In this tutorial, I had guided you through all the steps to install SpamAssassin in your ubuntu system. You can also follow my other articles.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

x