SpamAssassin 3.1.0 installation guide

Well, as usual, after spending much time trying to fix it, I find the answer myself shortly after posting a thread asking for help.

For some reason, CPAN had installed Net::DNS into /home/username/lib instead of /home/username/share, and no matter what I tried, I couldn’t get it to look in both ~/share and ~/lib. So finally, in a moment of duh, I just copied the modules into ~/share (guess I could have linked them, but oh well). Doing that, and setting SA up to use MySQL instead of the filesystem for Bayes, has fixed it up for now. Now I’m getting scores for spam of 37 instead of 0.1. :slight_smile:

For all of you who have followed the guide posted in the root post, to get the full potential of SA 3.1.0, you will need to install some CPAN modules into your home directory so it will use the DNS-based tests. If anyone is needs it, I can explain more, but you can figure it out by looking at the logs and using the CPAN shell and man page.

I updated the Wiki:

I tried the steps listed in the Wiki but the ‘make test’ failed. Could you clarify/verify the steps you listed? It’s like the dependencies aren’t found. For example:

Error: Can’t locate Net/ in @INC

Any ideas?


Sorry, guess that’s one I forgot and left out. I went back through my CPAN console history and added some more modules to the list in the Wiki. Try installing all that are listed there now, and see if it works then (don’t forget to link them when you’re finished). If you get any more errors, let me know. Thanks.

I think there’s a setting that’s missing. I’m still getting errors when I try to install Net::DNS. Net::IP installs without problems, probably because it doesn’t have any dependencies. However, Net::DNS needs IP and it can’t find it. I added the PREFIX path as you mentioned in the Wiki. The problem is that perl can’t find the libraries it just installed. How do I say, “Hey, you just installed Net::IP right here.”?


Well, you just need to follow the last step in the Wiki, where you create symlinks for the modules that, for some reason, get put in a different place–and it seems impossible to get Perl to look in both places. After I did that, everything worked fine.

I updated the guide to include a new step. Step 10: “Install modules necessary to enable DNS tests.” It’s slightly different from the Wiki but it seems to work. Spam scores immediately jumped when the DNS tests could run. If you find any missing steps, please let me know. Note: Step 10 can be done after all the other steps are completed. I simply inserted the step where I thought it made sense.

The URL again:


Thank you Matt, for updating this topic with the extra test. Since I already have the setup installed, I just did the new step #10. On the first instance of the command make install, the output contains:
Writing /home/myspamstopper/sausr/lib/perl/5.8.4/auto/Net/IP/.packlist
Appending installation info to /home/myspamstopper/sausr/lib/perl/5.8.4/perllocal.pod

but “myspamstopper” is my telnet login name for this SA experiment – not my home directory path. As a result, the next Makefile.PL command gives errors because Net::IP isn’t found.

So I should fix that little directory error before I do the second Makefile.PL command. Is that directory error just a file I can open in PICO and edit? Which file would it be?

[color=#CC0000]Get $50 off[/color] with promo code “LESS”! See here what else you get!


Perhaps I’m not understanding your problem. It still can’t find the Net::IP libraries after you export the PERL5LIB path? I had the same problem but when you export the path, it adds it to your terminal session. The %ENV and @INC should be updated accordingly.

At the shell type: perl -V to check. Once Net::DNS can find those libraries, it will link and the DNS tests for SA will be enabled.


No matter what I do, I can’t get the Bayes tests to run on Dreamhost’s mail servers. They run fine when I run my locally installed spamassassin in my home directory. Also, I’m sure that the mail server is executing the correct version of SA in my home dir, it just isn’t running the BAYES tests.

Any ideas?

You have to train at least 200 spams and 200 hams for the Bayes tests to run automatically. They’ll always run when you run ‘spamassassin -td’, but they’ll only run for real mail after you train it.

What I do is make a folder in my Maildir called “SpamAssassin”, and I move every spam I get into there. Then every night a cron job runs a script called “learn-spam” in my ~/bin directory that does this:

~/bin/sa-learn --nosync --spam ~/Maildir/.SpamAssassin/cur
~/bin/sa-learn --sync
mv ~/Maildir/.SpamAssassin/cur/* ~/Maildir/.Trash/cur

For training the ham, I just ran it against all of my non-spam folders in my Maildir:

~/bin/sa-learn --nosync --ham ~/Maildir/.non-spam-parent-folder./cur/
~/bin/sa-learn --sync

You can find out what’s been trained so far by running “~/bin/sa-learn --magic”.

I’ll add this to the Wiki. :slight_smile:

I’m sure I’ve trained it enough because when I run sa manually against a message it works fine - it’s only when it runs from the mail server that the bayes tests aren’t run. Can you send me the headers for one of your messages?

Like I said…

You have to train at least 200 spams and 200 hams for the Bayes tests to run automatically. They’ll always run when you run ‘spamassassin -td’ (i.e. manually), but they’ll only run for real mail after you train it.

You can find out what’s been trained so far by running “sa-learn --magic”.

Here’s the output from sa-learn --dump magic. Anything stick out at you?

0.000 0 3 0 non-token data: bayes db version 0.000 0 31983 0 non-token data: nspam 0.000 0 16984 0 non-token data: nham 0.000 0 139549 0 non-token data: ntokens 0.000 0 1122487953 0 non-token data: oldest atime 0.000 0 1133733595 0 non-token data: newest atime 0.000 0 0 0 non-token data: last journal sync atime 0.000 0 1133300389 0 non-token data: last expiry atime 0.000 0 5529600 0 non-token data: last expire atime delta 0.000 0 35768 0 non-token data: last expire reduction count

Well, that looks like you’ve trained enough. :slight_smile: I assume you’ve run “sa-learn --sync” too?

If so, you should check your procmail log for errors. Let me know if you find anything.

No errors in procmail log. I’ve tried to get the mail server to run sa in debug mode and capture the output, but redirecting standard error doesn’t seem to work.

Here’s my line in procmail:

| $HOME/sauser/bin/spamassassin -D 2>> $HOME/sa.debug.logIt looks like it gets hosed up somehow when mail comes in - can you think of another way that I could capture the debug output?

Here’s my .procmailrc file; use it to capture the errors from SA. Note, of course, that this is not the entire .procmailrc file, just the relevant parts. If you use this as your entire file, you might lose mail. Use this as a reference.


Set to “on” to debug


pipe email through spamassassin

| /home/me/bin/spamassassin
[/code]Change “VERBOSE” to “on”, then send yourself an email, and check $PMDIR/log. Using the errors there, I was able to finally get SA to work completely. :slight_smile:

Unfortunately, there’s an annoying little warning that SA always puts out:

warn: Use of uninitialized value in concatenation (.) or string at /home/me/share/perl/5.8.4/Mail/SpamAssassin/Plugin/ line 274.This results in output to the log for every message, even though it’s not an “error”, and SA works fine. So in my nightly cron script that trains sa-learn, I have it clear the procmail log too.

That got me farther - thanks! That’s helping me narrow it down. Long story, but the mail servers are pointing to non-dreamhost DNS and therefore resolving my mysql server name to the wrong address.

Life will be good in a few minutes once the TTL expires on my DNS entry (I use an external DNS server to have more control).

I have SA installed and the custom version is working, however, it does not appear that I can find a log file nor are DNS tests working.