Installation – Standalone Spam Assassin Server

This is my way on installing dedicated spam assassin server to be integrated with my internal mail server. This server better be run as virtual machine due to easy deployment and not heavy resources needed (depending on how many spam process you want it to run). In this case, we will use CentOS 5.5 64bit.

1. Install required RPM

yum install -y db4 db4-devel gcc libstdc++ libstdc++-devel

2. Update kernel, and others

yum update kernel
yum update

3. Reboot

4. Open Perl shell and install required perl modules

perl -MCPAN -e shell

(for first time user, you might need to accept default value if prompted)

install HTML::Parser
install NetAddr::IP
install Net::DNS::Resolver::Programmable
install Net::Ident
install Net::DNS
install DB_File
install Digest::SHA1
install Time::HiRes
install MIME::Base64
install Getopt::Long
install File::Copy
install Mail::SPF
install Mail::SPF::Query
install Mail::DKIM
install IP::Country
install IO::Socket::INET6
install IO::Socket::SSL
install Compress::Zlib
install LWP::UserAgent
install HTTP::Date
install Archive::Tar
install IO::Zlib
install Encode::Detect
install URI::Escape

5. Install Razor. Download it from http://razor.sourceforge.net/download :

cd /usr/local/src
wget http://prdownloads.sourceforge.net/razor/razor-agents-2.84.tar.bz2
bunzip2 razor-agents-2.84.tar.bz2
tar -xf razor-agents-2.84.tar
cd razor-agents*
perl Makefile.PL
make
make test
make install

6. Install SpamAssassin. Download the source from http://spamassassin.apache.org/downloads.cgi:

cd /usr/local/src
wget http://apache.lawyersdb.com/spamassassin/source/Mail-SpamAssassin-3.2.5.tar.gz
tar -xzf Mail-SpamAssassin-3.2.5.tar.gz
cd Mail-SpamAssassin-*
perl Makefile.PL
make
make install

7. Configure SpamAssassin, open file /etc/mail/spamassassin/local.cf via text editor and uncomment following:

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

8. Start spamd service

/usr/bin/spamd -d -u nobody -i x.x.x.x --allowed-ips=y.y.y.y/z --pidfile=/var/run/spamdx.pid --max-children=30 --min-children=20 &

(x.x.x.x = usually external IP of this server)
(y.y.y.y = IP that other server will connect to this spamd)
(z = subnet mask)

9. Open /etc/rc.local and add above command to make the spamd run automatically after next reboot

10. Get your MTA (mail server) to connect to this SpamAssassin server at port 783

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *