SpamAssassin for Dreamhost (2.61 revision)

Dreamhost webmail2 now includes SpamAssassin. Compiling your own local copy of the filter is unnecessary.

First off, this article applies only to Dreamhost users who have a shell account. You need a shell account because there is some required UNIX scripting involved. The whole process takes about 5 minutes to get up and running.

Installing SpamAssassin

Download the latest stable release of SpamAssassin, preferably in tar.gz format, from spamassassin.org. Open up your FTP program. If you don’t have an FTP client, download SmartFTP (Windows users) or Fetch (Mac users).

Log on to your web site via FTP and upload the SpamAssassin TAR file in BINARY format to the root directory. The root directory will list your web site, e.g. steinbaugh.com and it should contain a folder called Maildir.

Next, you need to log on to the server and run some commands. If you don’t have an SSH client, I recommend PuTTY (Windows users) or MacSSH (Mac users). Opt to log on to the server — use your domain name, e.g. steinbaugh.com — via SSH and be sure to use Port 22 (default SSH port). You will be greeted with a username/password prompt. If you can’t remember your login, reset it in the Dreamhost control panel.

Once you log in successfully, run the following commands:

tar xvfz Mail-SpamAssassin-2.61.tar.gz
cd ~/Mail-SpamAssassin-2.61
perl Makefile.PL PREFIX=~/sausr SYSCONFDIR=~/saetc
make
make install

SpamAssassin is now installed on the server. The next step is to set it up.

Configuring SpamAssassin

I’ve already created the four files you need to get SpamAssassin up and running. They are:

These files are available for download: spamassassin-2.61.tar.gz.

Again, upload the TAR file to your root directory and untar it using the SSH client. All you need to type to untar the file is:

tar xvfz spamassassin-2.61.tar.gz

Go back into your FTP client and locate the four extracted files (should be in a folder titled spamassassin-2.61). Move .forward.postfix and .procmailrc to the root directory. If these files already exist, back them up first and replace them.

Next, create a folder titled .spamassassin on the web root and move the user_prefs file into it.

Finally, move the spam.rc file to your procmail directory. If the procmail folder doesn’t exist, create it.

For testing purposes, I recommend modifying the .procmailrc file by turning verbose mode on and logging to all. This way you can check and make sure that SpamAssassin is working properly.

Now, send yourself an e-mail. View the full message header of the e-mail. You should see SpamAssassin outputting a header that says version 2.61. If it says version 2.20, the install failed. Dreamhost has an old version of SpamAssassin on the server which is currently 2.20. If you install is corrupted, version 2.20 will be called up instead.

I currently have Razor reporting turned off. Some Dreamhost customers have reported to me that Razor doesn’t work well with the SpamAssassin install. If you get Razor working with SA 2.61, please report what you did here. I heard that using -h with spamassassin in the spam.rc file might resolve the issue.

Once you’re done configuring and have verified that SpamAssassin is working, feel free to delete the Mail-SpamAssassin-2.61 directory from the server. All of the important SpamAssassin files are in saetc and sausr.

Upgrading

For a successful upgrade, delete the saetc and sausr folders. Then follow the guide above using the new version. The upgrade should work!

Published on December 20, 2003 2:43 AM PST (4 years, 9 months ago).

17 comments

Chris
(4 years, 8 months ago)

Thanks for posting this updated guide. I have a Dreamhost shell account, but for some reason I can’t seem to run sa-learn from the command line (I want to retrain the Bayesian filter on some of the messages that it incorrectly tagged as “ham”). sa-learn does appear in my sausr/local/bin directory, but when I try to run it I get the message “Command cannot be found”. I was under the impression that sa-learn gets installed automatically - is there something else that I need to do to get this working?

Thanks!

Chris
(4 years, 8 months ago)

I think I figured out what was causing the problem. I thought that I could just type in sa-learn at the command line, but I needed to specify the path to the sa-learn installed location. Seems to be working now.

Chris
(4 years, 8 months ago)

I think I figured out what was causing the problem. I thought that I could just type in sa-learn at the command line, but I needed to specify the path to the sa-learn installed location. Seems to be working now.

Matt
(4 years, 8 months ago)

Hello, Thank you for preparing this helpful article.

What is the syntax of the spam.rc file? I’ve got it open in a text editor, but I have no idea how to turn on ‘verbose mode’ or set logging to ‘all’. Thanks in advance!

william
(4 years, 8 months ago)

If you put the SA bin directory at the end of your $PATH, you can just type “sa-learn” instead of specifying the full path.

Anonymous
(4 years, 7 months ago)

Re: Matt, format of spam.rc file

spam.rc is just an included file for procmail… try doing a ‘man procmail’ for more info, or go to http://tinyurl.com/ytalv for procmail documentation.

Michael
(4 years, 7 months ago)

This is very helpful, thank you.

Could you clarify two things for me please?

1) How does this work if one hosts multiple domains at DreamHost? Can one arrange to have the change from the default (Razor) alter only one of the hosted domains, or is it an all-or-nothing deal?

2) Will the change affect people who are not shell or ftp users but just have m####### email acccounts? Is there a way to control this on a user-by-user or domain-by-domain basis?

Mike Steinbaugh
(4 years, 7 months ago)

Unfortunately, this tutorial only works for shell and FTP accounts — the m####### mail accounts only have Razor filtering. As for multiple domains, its an all or nothing kind of thing since the e-mail is going to your account and that isn’t dependent on the domain.

BobS
(4 years, 6 months ago)

Mike, Thanks! Worked great for SA 2.63 too.

Michael, On multiple domains, my experience is a little different than Mike’s. Maybe the difference is I used different shell Users for each domain. I had two domains setup to use the server’s SA 2.20 (without Razor previously turned on thru panel). When I installed SA2.63 in my home on one domain, it did NOT effect the other domain.

On razor, it seems to be working some, although mostly just piling on extra score for things SA would’ve tagged as spam anyway. Not sure it’s working “right.” I put stuff into user_prefs from http://www.yrex.com/spam/spamconfig.php and a couple rules into .procmailrc:

# filter 0 - first tag message with razor
:0 Wc
| razor-check

:0 Waf
| formail -A "X-Razor2-Warning: SPAM."

Haven’t seen any sign of the 2nd one doing anything…

BobS
(4 years, 6 months ago)

One other minor comment - It’s quicker to get the install tar.gz file by using wget while ssh’d to the server, rather than download/upload. Just paste the URL into the command line.

rough around the edges
(4 years, 5 months ago)

Spam spam spam spam

Wellferchrissakes. SpamAssassin is still only working on one out of the three accounts. This is probably because I have only the faintest clue what I’m doing. I’ve read Webspiffy’s guide to installing SpamAssassin at Dreamhost (Dreamhost being my webho…

Nik
(4 years, 3 months ago)

If I install SpamAssassin, will that be enabled for all email accounts in my domain, or will it only work for the one account I install it for?

Mike Steinbaugh
(4 years, 3 months ago)

Following my instructions, that will only activate it for your user account. There is no way to do a domain-wide install on Dreamhost’s servers.

Fred Lewis
(4 years, 2 months ago)

Hi, would anyone here please comment on how well Spam Assasin works versus Razor? I get about 60-70 spams per day and currently Razor is catching only about 28 percent of them. I have never used a shell account before but I think I might be able to stumble my way through the very helpfull directions on this site. But is it worth it? Also, I think some Dreamhost users would be willing to pay a small setup fee to have Spam Assasin installed for them by a Dreamhost staff member. Just a thought. Again, aassuming it’s better than Razor. Thanks.

Jonathan Webb
(3 years, 9 months ago)

I installed SpamAssassin 3.02 today, your pages on setup were helpful. I’m curious as to why you make so many subdirectories (sausr, saetc, .procmail, and .spamassassin)? For my install, I put everything in ~/.spamassassin and it seems to be working fine. By everything, I mean all of the SpamAssasin application files, as well as the ’spam.rc’ and ‘user_prefs’ files you’ve provided.

I built the SpamAssassin makefile using:

perl ./Makefile.PL PREFIX=~/.spamassassin

Then edited the include file in my ~/.procmailrc to:

INCLUDERC=$HOME/.spamassassin/spam.rc

And edited the filter in my ~/.spamassassin/spam.rc:

:0fw: spamassassin.lock | $HOME/.spamassassin/local/bin/spamassassin

Additionally there were some issues with SpamAssassin and the current versions of the perl Net::DNS module and razor2 on dreamhost. I added the following lines to my ~/.spamassassin/user_prefs and it seems to be working fine:

dns_available yes use_razor2 0

Anonymous
(3 years, 7 months ago)

After having problems installing Spamassassin 3.0.1 on Dreamhost I got 2.64 off old.spamassassin.org and followed this guide for the third time. However it appears with 2.64 you need to run sa-learn –rebuild before running any sa-learns for the first time. Could just have been my messed up install but I didn’t have this problem with 2.63 and this guide.

Mike Steinbaugh
(3 years, 5 months ago)

This guide is no longer relevant. Dreamhost webmail2 now includes SpamAssassin support, so compiling your own local copy is unnecessary.

 Next post