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, 8.X and even 9.X so have no fears! 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. 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/20030428SPAM/ mkdir /tmp/20030428SPAM cd /tmp/20030428SPAM/ #GET ALL THE TAR FILES wget http://www.peregrinehw.com/downloads/SpamAssassin/libnet-1.0901.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/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.54.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/Test-Harness-2.26.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Test-Simple-0.45.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Time-HiRes-01.20.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/razor-agents-2.22.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.26.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/HTML-Tagset-3.03.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/URI-1.22.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/MIME-Base64-2.12.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/Digest-MD5-2.20.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/File-Spec-0.82.tar.gz wget http://www.peregrinehw.com/downloads/SpamAssassin/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/20030428SPAM/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 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install HTML-Parser v3.26 cd /usr/src tar zxvf /tmp/20030428SPAM/HTML-Parser-3.26.tar.gz cd HTML-Parser-3.26/ perl Makefile.PL make make test make install cd /usr/src tar zxvf /tmp/20030428SPAM/libnet-1.0901.tar.gz cd libnet-1.0901 perl Configure -d perl Makefile.PL make #make test #OPTIONAL make install #Added supporting products for Net-DNS and Razor (versions 1 & 2) 07-02-2002 cd .. tar zxvf /tmp/20030428SPAM/Digest-SHA1-2.01.tar.gz cd Digest-SHA1-2.01 perl Makefile.PL make make test make install # NOTE: A Digest-MD5 is included with Perl 5.8.0 so you shouldn't need this (and possibly other modules # with RH9) # # UPDATED: 09-23-02 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install DigestMD5 v2.20 cd /usr/src/ tar zxvf /tmp/20030428SPAM/Digest-MD5-2.20.tar.gz cd Digest-MD5-2.20/ perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Digest-HMAC-1.01.tar.gz cd Digest-HMAC-1.01 perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Devel-CoreStack-1.3.tar.gz cd Devel-CoreStack-1.3 perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Test-Harness-2.26.tar.gz cd Test-Harness-2.26 perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Test-Simple-0.45.tar.gz cd Test-Simple-0.45 perl Makefile.PL make make test make install #Upgraded to Net-DNS v0.23 on 7-2-02 to get rid of deprecated message #Fixed bug on 7-17-02 thanks to Timothy Tisdel #Upgraded to Net-DNS v0.31 to fix some testing errors. Thanks to Michael Lessard for his testing! cd .. tar zxvf /tmp/20030428SPAM/Net-DNS-0.31.tar.gz cd Net-DNS-0.31 perl Makefile.PL [INTERACTIVE] make make test make install #Moved higher in the order for Razor dependencies. Thanks to Tim Tisdel! cd .. tar zxvf /tmp/20030428SPAM/Time-HiRes-01.20.tar.gz cd Time-HiRes-01.20 perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Digest-Nilsimsa-0.06.tar.gz cd Digest-Nilsimsa-0.06 perl Makefile.PL make make test make install # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install MIME-Base64 v2.12 cd /usr/src/ tar zxvf /tmp/20030428SPAM/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 # # HOMEPAGE: http://search.cpan.org/author/GAAS/ # # Install URI v1.22 cd /usr/src tar zxvf /tmp/20030428SPAM/URI-1.22.tar.gz cd URI-1.22/ perl Makefile.PL make make test make install #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 #05-05-2003 -- Updated to agents 2.22 -- non-critical cd .. tar zxvf /tmp/20030428SPAM/razor-agents-2.22.tar.gz cd razor-agents-2.22 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 cd .. tar zxvf /tmp/20030428SPAM/MailTools-1.41.tar.gz cd MailTools-1.41 perl Makefile.PL make make test make install cd .. tar zxvf /tmp/20030428SPAM/Mail-Audit-1.11.tar.gz cd Mail-Audit-1.11 perl Makefile.PL make make test make install #ADDED: 03-12-2002 # #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 .. tar zxvf /tmp/20030428SPAM/File-Spec-0.82.tar.gz cd File-Spec-0.82 perl Makefile.PL make make test make install ADDED: 03-12-2002 # #PodParser v1.21 # #Most likely only needed with older installations of Perl # #HOMEPAGE: http://search.cpan.org/author/MAREKR/PodParser-1.21/ cd .. tar zxvf /tmp/20030428SPAM/PodParser-1.21.tar.gz cd PodParser-1.21 perl Makefile.PL make make test make install #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 #UPDATED 05-12-2003 to 2.54 cd .. tar zxvf /tmp/20030428SPAM/Mail-SpamAssassin-2.54.tar.gz cd Mail-SpamAssassin-2.54 perl Makefile.PL *INTERACTIVE* make make test make install #REMOVE THE TEMPORARY FILES rm -rf /tmp/20030428SPAM/ #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 -P :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.54/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.54/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