INSTALL INSTRUCTIONS This is my HOW-TO install SpamAssassin on a RedHat system using sendmail installed per my sendmail instructions available from http://www.pccc.com/downloads/. These instructions were tested and written using various Redhat 5.X to 9.X servers but we've constantly worked and tweaked with users of other packages as well. Because they are a frame work for using the original source code, many people have reported excellent luck in following these how-to's on a variety of Linux distributions. 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 though you can also get the 7 extra files below that are commented and use Perl 5.6.X as well. 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! 7th NOTE: see INSTALL-RH9-NOTES to find out some more tricks to configure SpamAssassin to run with RedHat 9 AUTHOR: Kevin A. McGrail / kmcgrail@pccc.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/20040119SPAM/ mkdir /tmp/20040119SPAM cd /tmp/20040119SPAM/ #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.63.tar.bz2 wget http://www.peregrinehw.com/downloads/SpamAssassin/MailTools-1.41.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Net-DNS-0.48.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.36.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Razor2-2.36_taint_patch.patch 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.35.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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/Test-Simple-0.47.tar.gz cd Test-Simple-0.47/ perl Makefile.PL make make test make install # UPDATED: 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! # UPDATED: v0.48 to allow for SPF queries (for SA 3.x) # # Install Net DNS v0.48 cd /usr/src tar zxvf /tmp/20040119SPAM/Net-DNS-0.48.tar.gz cd Net-DNS-0.48 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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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 # UPDATED: 06-25-2004 v1.31 # UPDATED: 12-31-2004 v1.35 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install URI v1.35 cd /usr/src tar zxvf /tmp/20040119SPAM/URI-1.35.tar.gz cd URI-1.35/ perl Makefile.PL make make test make install # UPDATED: 09-23-2003 -- Updated to agents 2.36 -- Required for Taint Patch for 2.60 SA # 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.36 cd /usr/src tar zxvf /tmp/20040119SPAM/razor-agents-2.36.tar.gz cd razor-agents-2.36 patch -p0 -d lib/Razor2 < /tmp/20040119SPAM/Razor2-2.36_taint_patch.patch perl Makefile.PL make make test make install #Create a Razor Client Identity (Needed for SpamAssassin Tests) #NOTE: Sometimes it puts these in /usr/local/ but I haven't figured out why... /usr/bin/razor-client /usr/bin/razor-admin -create /usr/bin/razor-admin -register #... Repeat register until successful # Install MailTools v1.41 cd /usr/src tar zxvf /tmp/20040119SPAM/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/20040119SPAM/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/20040119SPAM/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/20040119SPAM/PodParser-1.21.tar.gz # cd PodParser-1.21 # perl Makefile.PL # make # make test # make install # UPDATED 02-04-2004 to 2.63 # UPDATED 01-19-2004 to 2.62 # UPDATED 12-09-2003 to 2.61 # UPDATED 09-23-2003 to 2.60 # 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.63 #***IMPORTANT NOTE TO PEOPLE UPGRADING TO v2.6X FROM v2.5X (or previous) AND USING BAYES # # There are changes with Bayes Database Handling that require extra steps for an upgrade #Stop your spamassassin daemons (spamd or MimeDefang daemons) #sa-learn --rebuild #Upgrade to 2.60 #Make sure you have the DB_File module. If you don't, install it (not covered here) #and run an import of the bayes data (sa-learn --import) #sa-learn --rebuild #Restart your spamassassin daemons cd /usr/src/ tar jxvf /tmp/20040119SPAM/Mail-SpamAssassin-2.63.tar.bz2 cd Mail-SpamAssassin-2.63 perl Makefile.PL #*INTERACTIVE* Note: 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/20040119SPAM/ #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 #OPTIMIZATION #1 -- INSTALL SPAMC/SPAMD #SpamD is a daemon to process spam that will greatly speed up SpamAssassin and lower your #resource usage. It is HIGHLY RECOMMENDED to perform this step /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 'SPAMDOPTIONS="-d -a -q -x -u spamd"' cd /usr/src/Mail-SpamAssassin-2.63/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 chkconfig --add spamassassin #OR MANUALLY ADD TO YOUR RUN LEVEL, FOR EXAMPLE: #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.63/spamd/ cp spamd spamc /usr/bin/ #START THE DAEMON /etc/rc.d/init.d/spamassassin start #CHANGE YOUR PROCMAIL FILE #replace your call to | spamassassin with the following line: | spamc -f # OPTIMIZATION #2 -- SETUP A DEFAULT SITE-WIDE 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=PCCC # 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 #NOTE: Sitewide installations might want to consider using MIMEDefang. #See http://www.pccc.com/downloads/ for How-To's about MIMEDefang! # OPTIMIZATION #3 -- SETUP A DATABASE TO STORE USER PREFERENCES #CREATE THE DATABASE TO STORE USERPREFS AND CONFIGURE SPAMASSASSIN TO USE IT /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(100) NOT NULL default '', 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 # MODIFY THE SPAMASSASSIN CONF FILE # The default configuration files are located in /etc/mail/spamassassin/local.cf # Add the following lines and modify the database password you used above user_scores_dsn DBI:mysql:spamassassin:localhost user_scores_sql_username spamassassin user_scores_sql_password # OPTIMIZATION #4 -- SETUP A TOOL TO ALLOW USERS TO CHANGE THEIR PREFERENCES # See INSTALL-PHP-SA for instructions on installation just one of the many user # preferences tools available.