INSTALL INSTRUCTIONS This is basically my HOW-TO install SpamAssassin on a RedHat system using sendmail installed per my sendmail instructions. These instructions were tested and written using various Redhat 5.X to 7.X servers and these exact instructions are for RedHat 7.2. We've also constantly tweaked and worked with users with RH 7.X, NOTE: SpamAssassin is just awesome! It's worth the time to set it up!!!! 2nd NOTE: Thanks to Michael Huettich for letting me know that this install works on SuSE 7.2 Pro! 3rd NOTE: SpamAssassin has changed their default tagging method. Make sure your procmail users are checking for ^X-Spam-Status: Yes or set rewrite_subject to 1 in the configuration. 4th NOTE: SpamAsssassin will be requiring a newer perl soon. This document is being heavily updated for Perl 5.8.0. 5th NOTE: More reports that these walk-throughs worked very well with SuSE 7.3 and Debian 3.0 from Sebastian Steinlechner! Thanks for the update! It requires some of the files from http://www.peregrinehw.com/downloads/SpamAssassin/old but that is "normal" due to the perl versions. 6th NOTE: Another report that these walk-throughs worked very well with SuSE 8.2 with kmail though using some of the /old files as above. Thanks to Alan Wright for the note! kevin@mcgrail.com #WGET, UNTAR & INSTALL THE VARIOUS SUPPORT DISTRIBUTIONS # # NOTE: Yes, I do know that CPAN can do this automatically but I am a bit of a freak who likes to confirm # the exact version I am getting. # #CREATE A TEMP DIR FOR THE TAR FILES rm -rf /tmp/20030708SPAM/ mkdir /tmp/20030708SPAM cd /tmp/20030708SPAM/ #GET ALL THE TAR FILES wget http://www.peregrinehw.com/downloads/SpamAssassin/libnet-1.16.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Digest-HMAC-1.01.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Digest-SHA1-2.01.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/Devel-CoreStack-1.3.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Mail-Audit-1.11.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Mail-SpamAssassin-2.55.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/MailTools-1.41.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Net-DNS-0.31.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/Test-Harness-2.26.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Test-Simple-0.47.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/Time-HiRes-01.20.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/razor-agents-2.34.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Digest-Nilsimsa-0.06.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/HTML-Parser-3.28.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/HTML-Tagset-3.03.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/URI-1.23.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/MIME-Base64-2.12.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/Digest-MD5-2.20.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/File-Spec-0.82.tar.gz #wget http://www.peregrinehw.com/downloads/SpamAssassin/old/PodParser-1.21.tar.gz #CLEAR OUT OLD SOURCE rm -rf /usr/src/libnet-1.* rm -rf /usr/src/Digest-HMAC-1.* rm -rf /usr/src/Digest-SHA1-2.* rm -rf /usr/src/Devel-CoreStack-1.* rm -rf /usr/src/Mail-Audit-1.* rm -rf /usr/src/Mail-SpamAssassin-2.* rm -rf /usr/src/MailTools-1.* rm -rf /usr/src/Net-DNS-0.* rm -rf /usr/src/Test-Harness-2.* rm -rf /usr/src/Test-Simple-0.* rm -rf /usr/src/Time-HiRes-01* rm -rf /usr/src/razor-agents-2.* rm -rf /usr/src/Digest-Nilsimsa-0.* rm -rf /usr/src/HTML-Parser-3* rm -rf /usr/src/HTML-Tagset-3* rm -rf /usr/src/URI-1* rm -rf /usr/src/MIME-Base64-2* rm -rf /usr/src/Digest-MD5-2* rm -rf /usr/src/File-Spec-0* rm -rf /usr/src/PodParser-1* # HOMEPAGE: http://search.cpan.org/author/SBURKE/ # # Install HTML-Tagset v3.03 cd /usr/src tar zxvf /tmp/20030708SPAM/HTML-Tagset-3.03.tar.gz cd HTML-Tagset-3.03/ perl Makefile.PL make make test make install # UPDATED: 09-23-2002 v3.26 # UPDATED: 06-22-2003 v3.28 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install HTML-Parser v3.28 cd /usr/src tar zxvf /tmp/20030708SPAM/HTML-Parser-3.28.tar.gz cd HTML-Parser-3.28/ perl Makefile.PL # *INTERACTIVE for Perl 5.7 and greater* make make test make install # UPDATED: 06-22-2003 v1.16 # # HOMEPAGE: http://www.cpan.org/authors/id/G/GB/GBARR/ # # Install libnet v1.16 cd /usr/src tar zxvf /tmp/20030708SPAM/libnet-1.16.tar.gz cd libnet-1.16/ perl Configure -d perl Makefile.PL make #make test #OPTIONAL make install # ADDED 07-02-2002 v2.01 # # Install Digest SHA1 v2.01 cd /usr/src tar zxvf /tmp/20030708SPAM/Digest-SHA1-2.01.tar.gz cd Digest-SHA1-2.01 perl Makefile.PL make make test make install # UPDATED: 09-23-02 # REMOVED: 06-22-03 INCLUDED WITH PERL 5.8.0 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install DigestMD5 v2.20 # cd /usr/src/ # tar zxvf /tmp/20030708SPAM/Digest-MD5-2.20.tar.gz # cd Digest-MD5-2.20/ # perl Makefile.PL # make # make test # make install # ADDED 07-02-2002 v2.01 # # Install Digest HMAC v1.01 cd /usr/src tar zxvf /tmp/20030708SPAM/Digest-HMAC-1.01.tar.gz cd Digest-HMAC-1.01 perl Makefile.PL make make test make install # ADDED: 07-02-2002 v1.3 # REMOVED: 06-22-2003 PREREQ FOR Test-Harness which was removed # # HOMEPAGE: http://search.cpan.org/author/ADESC/ # # Install Devel-CoreStack v1.3 # cd /usr/src # tar zxvf /tmp/20030708SPAM/Devel-CoreStack-1.3.tar.gz # cd Devel-CoreStack-1.3 # perl Makefile.PL # make # make test # make install # ADDED: 09-23-2002 v2.26 # REMOVED: 06-22-2003 INCLUDED WITH PERL 5.8.0 # # HOMEPAGE: http://search.cpan.org/author/MBARBON/ # # Install Test-Harness v2.26 # cd /usr/src # tar zxvf /tmp/20030708SPAM/Test-Harness-2.26.tar.gz # cd Test-Harness-2.26/ # perl Makefile.PL # make # make test # make install # UPDATED: 06-22-2003 v0.47 # # HOMEPAGE: http://search.cpan.org/author/MBARBON/ # # Install Test-Simple v0.47 cd /usr/src tar zxvf /tmp/20030708SPAM/Test-Simple-0.47.tar.gz cd Test-Simple-0.47/ perl Makefile.PL make make test make install # UDATED: 2002-07-02 v0.23 to get rid of deprecated message # UPDATED: 2002-07-17 Fixed bug thanks to Timothy Tisdel # UPDATED: v0.31 to fix some testing errors. Thanks to Michael Lessard for his testing! # # Install Net DNS v0.31 cd /usr/src tar zxvf /tmp/20030708SPAM/Net-DNS-0.31.tar.gz cd Net-DNS-0.31 perl Makefile.PL [INTERACTIVE] make make test make install # UPDATED: Moved higher in the order for Razor dependencies. Thanks to Tim Tisdel! # REMOVED: 2003-06-22 INCLUDED WITH PERL 5.8.0 # # Install Time HiRes v1.20 # cd /usr/src # tar zxvf /tmp/20030708SPAM/Time-HiRes-01.20.tar.gz # cd Time-HiRes-01.20 # perl Makefile.PL # make # make test # make install # Install Digest Nilsimsa v0.06 cd /usr/src tar zxvf /tmp/20030708SPAM/Digest-Nilsimsa-0.06.tar.gz cd Digest-Nilsimsa-0.06 perl Makefile.PL make make test make install # REMOVED: 2003-06-22 INCLUDED WITH PERL 5.8.0 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install MIME-Base64 v2.12 # cd /usr/src/ # tar zxvf /tmp/20030708SPAM/MIME-Base64-2.12.tar.gz # cd MIME-Base64-2.12/ # perl Makefile.PL # make # make test # make install # UPDATED: 09-23-2002 v1.22 # UPDATED: 6-3-2002 v1.19 # UPDATED: 06-22-2003 v1.23 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install URI v1.23 cd /usr/src tar zxvf /tmp/20030708SPAM/URI-1.23.tar.gz cd URI-1.23/ perl Makefile.PL make make test make install # UPDATED: 07-08-2003 -- Updated to agents 2.34 -- Required for 2.55 SA # UPDATED: 05-05-2003 -- Updated to agents 2.22 -- non-critical # # OLD UPDATE NOTES: # 03-12-2002 -- Razor v1.X clients no longer supported by SpamAssassin -- Docs regarding this removed -- No problems with Razor seen in months # 10-10-2002 -- SpamAssassin support for Razor v2.0 has been stable for a few weeks & we are switching. # Please let us know of problems as we have not tested this as much as we would like. # 11-14-2002 -- We are disabling Razor as it is causing too many issues # 11-18-2002 -- The Razor bug is a problem with Spamc/d and has been documented in Bug 1151 for SpamAssassin. # Because of this, we are still going to install Razor's tools and will recommend setting # score RAZOR_CHECK 0 # score RAZOR2_CHECK 0 # # *IF* you see problems # # Install Razor Agents v2.34 cd /usr/src tar zxvf /tmp/20030708SPAM/razor-agents-2.34.tar.gz cd razor-agents-2.34 perl Makefile.PL make make test make install #Create a Razor Client Identity (Needed for SpamAssassin Tests) /usr/bin/razor-client /usr/bin/razor-admin -create /usr/bin/razor-admin -register # Install MailTools v1.41 cd /usr/src tar zxvf /tmp/20030708SPAM/MailTools-1.41.tar.gz cd MailTools-1.41 perl Makefile.PL make make test make install # Install Mail Audit v1.11 cd /usr/src tar zxvf /tmp/20030708SPAM/Mail-Audit-1.11.tar.gz cd Mail-Audit-1.11 perl Makefile.PL make make test make install # ADDED: 03-12-2002 # REMOVED: 06-22-2003 INCLUDED WITH PERL 5.8.0 # #File-Spec v0.82 # #Most likely only needed with older installations of Perl # #HOMEPAGE: http://search.cpan.org/author/RBS/File-Spec-0.82/ # cd /usr/src/ # tar zxvf /tmp/20030708SPAM/File-Spec-0.82.tar.gz # cd File-Spec-0.82 # perl Makefile.PL # make # make test # make install # ADDED: 03-12-2002 # REMOVED: 06-22-2003 INCLUDED WITH PERL 5.8.0 # # PodParser v1.21 # # Most likely only needed with older installations of Perl # # HOMEPAGE: http://search.cpan.org/author/MAREKR/PodParser-1.21/ # cd /usr/src/ # tar zxvf /tmp/20030708SPAM/PodParser-1.21.tar.gz # cd PodParser-1.21 # perl Makefile.PL # make # make test # make install # UPDATED 07-08-2003 to 2.55 # UPDATED 05-12-2003 to 2.54 # UPDATED 06-19-2002 to 2.30 # UPDATED 07-02-2002 to 2.31 # UPDATED 09-14-2002 to 2.41 # UPDATED 10-04-2002 to 2.42 # DOWNGRADED 10-10-2002 to 2.41 # UPDATED 10-15-2002 to 2.43 # UPDATED 02-01-2003 to 2.44 # UPDATED 04-28-2003 to 2.53 # # HOMEPAGE: http://www.spamassassin.org/ # # Install SpamAssassin v2.55 cd /usr/src/ tar zxvf /tmp/20030708SPAM/Mail-SpamAssassin-2.55.tar.gz cd Mail-SpamAssassin-2.55 perl Makefile.PL #*INTERACTIVE* I usually say yes, run the tests make make test make test #NOTE: run the make test twice. Razor2 tests always seem to fail the first time. # Believe it creates a dir or file or something. make install #REMOVE THE TEMPORARY FILES rm -rf /tmp/20030708SPAM/ #INSTALL THINGS SIMPLY USING PROCMAIL ON JUST ONE ACCOUNT Add a file called .procmailrc to the home dir of the user with the following contents :0fw | spamassassin :0e { EXITCODE=$? } :0: * ^X-Spam-Status: Yes SPAM ### END OF STEP 1 -- SPAMASSASSIN IS NOW WORKING -- CONTINUE AHEAD FOR OPTIMIZATION AND FEATURES # ASSUMING YOU'VE INSTALLED THE APACHE/MYSQL/DBI INSTRUCTIONS, YOU CAN SETUP SPAMASSASSIN TO USE THE DATABASE AND SPAMC/D #INSTALL SPAMC/SPAMD /usr/sbin/adduser -c "SpamAssassin" -s /bin/false spamd -u 103 #UPDATED 8-15-02 thanks to Alyn Hockey #EDIT THE INITD SCRIPT AND EDIT LINE 24 TO SAY 'OPTIONS="-d -a -q -x -u spamd"' cd /usr/src/Mail-SpamAssassin-2.55/spamd/ vi redhat-rc-script.sh cp redhat-rc-script.sh /etc/rc.d/init.d/spamassassin chmod +x /etc/rc.d/init.d/spamassassin cd /etc/rc.d/rc3.d; ln -s ../init.d/spamassassin S81spamassassin cd /etc/rc.d/rc0.d; ln -s ../init.d/spamassassin K31spamassassin mkdir /home/spamd/.spamassassin chown spamd.spamd /home/spamd/.spamassassin cd /usr/src/Mail-SpamAssassin-2.55/spamd/ cp spamd spamc /usr/bin/ #START THE DAEMON /etc/rc.d/init.d/spamassassin start #CREATE THE DATABASE /usr/local/mysql/bin/mysqladmin -p create spamassassin mysql -p GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON spamassassin.* TO spamassassin identified by ''; connect spamassassin CREATE TABLE userpref ( username varchar(8) NOT NULL, preference varchar(30) NOT NULL, value varchar(100) NOT NULL, prefid int(11) NOT NULL auto_increment, PRIMARY KEY (prefid), INDEX (username), INDEX (preference), INDEX (value) ) TYPE=MyISAM; quit # INSTALL THE CONF FILE mkdir /etc/mail/spamassassin Edit localdb.cf and copy it to /etc/mail/spamassassin # SETUP A DEFAULT PROCMAIL # Here's the /etc/procmailrc we use. It places the SPAM in a seperate folder in the users IMAP dir. # For POP users, simply remove everything including the line :0: to the end. DROPPRIVS=yes #Uncomment the following lines to allow for logging # #LOGFILE=/var/log/procmail #VERBOSE=ON COMPANY=PHW # The condition line ensures that only messages smaller than 250 kB # (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam # isn't bigger than a few k and working with big messages can bring # SpamAssassin to its knees. :0fw * < 256000 | /usr/bin/spamc -f :0e { EXITCODE=$? } :0: * ^X-Spam-Status: Yes $HOME/IMAP-$COMPANY/SPAM