SpamAssassin install on home directory

I am on a shared server, and would like to use SpamAssassin 3.x , so I need to install my own copy. (DH Spamassassin is stuck at 2.x, they don’t seem to be in any hurry to upgrade).

So I followed instructions from to try to install it locally. For some reason, I am getting errors when its invoked from my procmail.

Has anyone gotten a local install of spamassassin to work correctly? Would you like to share tips and tricks?


Google -> spamassassin dreamhost

Or enable the junk filter if that works for you.

Also, with the latest spamassassin installs, you may have to install locally an updated DNS lookup perl module or something similar.

Its been so long though I can’t give you the details about how I did it. I’d have to relearn at this point myself.

Good luck,

I don’t remember having to do anything unusual to get it working. But I’ve been running it forever, so I might be forgetting as well. The upgrade to 3.0 was no trouble at all.

It might help to see what those error messages you speak of say. (Google usually helps with this as well… I find that if I put any error message into Google, I’ll find someone who had the same problem.)

Thank you all for your replies.

Well I cleaned up my previous spamassassin install, and tried it once again, from scratch:

Download and install spamassassin:

[code]# wget

tar zxvf Mail-SpamAssassin-3.0.4.tar.gz

cd Mail-SpamAssassin-3.0.4

perl Makefile.PL PREFIX=~/sausr SYSCONFDIR=~/saetc[/code]

During the above step, I get a warning (or is it an error?):

opendir(./../..): Permission denied at /usr/local/lib/perl/5.6.1/File/ line 597 But the command eventually succeeds.

So I continue the installation:

[code]# make

make install[/code]

Now try to run spamassassin, and there is an error:

# ~/sausr/local/bin/spamassassin [b]Can't locate Mail/SpamAssassin/ in @INC (@INC contains: /home/myusrname>/sausr/local/share/perl/5.6.1 /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl) at /home/<myusrname>/sausr/local/bin/spamassassin line 81. BEGIN failed--compilation aborted at /home/<myusrname>/sausr/local/bin/spamassassin line 81.[/b]

Any ideas to solve this problem would be appreciated.

Those are the same commands I use (although I don’t specify SYSCONFDIR anymore for some reason.)

The file it’s looking for should be here:


Does that file exist?

[quote]The file it’s looking for should be here:


Does that file exist?[/quote]
my ~/sausr/local/share/perl/5.6.1 directory exists, but there is nothing inside it. It is an empty directory!

Could it to do with the earlier warning I got in the perl Makefile.PL step?

When you do this step, do you see a similar warning message?

Nope, I don’t get that warning, even if I use the command exactly as you wrote it.

That command asks 4 questions; I accept the default for each.

I do get the following warning:
Warning: optional module Net::DNS 0.34 not found (0.19 currently installed) at Makefile.PL line 433.

but it’s just a warning, not a fatal error.

Do you have any perl-related special environment variables set (e.g PERL5LIB) when you install SpamAssassin?


SA won’t work very well without Net::DNS. A whole lot of effective tests don’t work without it.

There is a way to get it to add a “use lib …” for a copy installed in your home dir. I successfully did this for an install I did for my sister - but just recently noticed that I specified the wrong path (oops). Can’t remember for sure, but I think you need to set INSTALLSITELIB when you’re building the program.

so I think something like:
perl Makefile.PL PREFIX=$HOME INSTALLSITELIB=$HOME/lib/local/share/perl/5.6.1
(or whatever).

I do have PERL5LIB set like so:


… but there’s nothing related to SpamAssassin in there.
Just Geo::IPfree and Memoize, both for Awstats.

I tried to install Net::DNS using CPAN, but most of its tests
failed for some reason. If I ever bother to get it installed,
I’ll try the INSTALLSITELIB thing. :slight_smile: (Unless PERL5LIB is enough.)

Actually, spam hasn’t been a problem for me in a while. I
think it’s the Bayes filter–almost all of my spam comes in
with BAYES_99. RAZOR2 is another common one. But then
again, I only get 1-2 spam per day on this account.

With regards to the original question, we should probably
examine the error more closely:

opendir(./…/…): Permission denied at /usr/local/lib/perl/5.6.1/File/ line 597

I have no idea where it’s starting from, but it looks like it’s
trying to access the grandparent directory. You’re installing
in ~/sausr. I’m installing in ~/usr/spamassassin. Try that
instead. If it’s trying to access /home, it might cause a
permission denied error.

If that doesn’t work, next step might be to look at line 597
and try to figure out what it’s trying to do.

Or search Google for that error. I haven’t tried that.

I don’t think PERL5LIB will affect the program installation.

The File::Find thing is due to permissions on (IIRC) /home or else /home/.foo. If you write support, they can change it in the short term, which should fix your install difficulties.

Yes, this sounds like the most likely cause. I have sent off a support request, lets see how they respond. Thank you for your help.

When I try to do “ls -l /home/.foo” (foo replaced by my actual server name), I get “permission denied”. When I asked support to change the permissions, they unfortunately refused:

unfortunately, that’s not something we can simply change. WE keep our data permissions set a certain way. SpamAssassin is compatible with our system, we have many users that have it installed.

So I am curious as to why you are not seeing this warning when you install spamassassin. Do you guys have read permissions on your respective /home/.foo directories?

Perhaps all of this would be moot if I can get DH to upgrade spamassassin from 2.20 (ancient) to the latest. Perhaps you folks can help me with this by voting on this suggestion:

Vote to have Dreamhost Upgrade to latest version of SpamAssassin

Thanks in advance!

I have read permission on /home/.foo.

What if you add another level to your install directory path: instead of ~/foo try installing into ~/foo/bar.

I mentioned earlier that I was installing into a directory like
~/foo/bar, which may me why my installation was working
and the original poster’s wasn’t. So that’s what I would recommend doing.

side note - I did test this, and it does work if you set INSTALLSITELIB to the directory where the Net::DNS install is (it will also then put the SA Perl modules in the same path).

Setting PERL5LIB will also work, but I’m not sure if you can set PERL5LIB from a .procmailrc - procmail is somewhat careful about what environment variables it lets you set.

spamassassin -D < [file with an email in it]

You’ll see:
debug: is Net::DNS::Resolver available? yes
debug: Net::DNS version: 0.48

If you want to be able to look through the output easier, you can do something like:

spamassassin -D < spam 2> spamassassin.out

then grep for “::DNS” in the file spamassassin.out

You might try my installation instructions for version 2.6.1 here and upgrade instructions for 3.0.2 here.

Thus far, I’ve only automated the scanning of spam and ham messages via a weekly cron job. That requires sorting and keeping the mail on the server, which is another reason to use SquirrelMail.

I hope it works for you!

Finally, dreamhost customer support has fixed my directory permission problem,
so I can now actually browse the directory /home/.foo

However, I still have problems with installing SpamAssassin

[code]# wget

tar zxvf Mail-SpamAssassin-3.0.4.tar.gz

cd Mail-SpamAssassin-3.0.4

perl Makefile.PL PREFIX=~/sausr[/code]

Now I no longer get the warning about “Permission denied” that I was getting earlier.

Continuing with the install…

[code]# make

make install[/code]

Now try spamassassin, and there is that same old error:

# ~/sausr/local/bin/spamassassin baht:~/Mail-SpamAssassin-3.0.4> ~/sausr/local/bin/spamassassin [b]Can't locate Mail/SpamAssassin/ in @INC (@INC contains: /home/<myusername>/sausr/local/share/perl/5.6.1 /usr/local/lib/perl/5.6.1 /usr/local/share /perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl) at /home/<myusername>/sausr/local/bin/spamassassin l ine 81. BEGIN failed--compilation aborted at /home/<myusername>/sausr/local/bin/spamassassin line 81.[/b]
Any ideas? Isn’t the ArchiveIterator perl module supposed to get installed when I install SpamAssassin?

my ~/sausr/local/share/perl/5.6.1 directory exists, but it is empty

I have tried setting environment variable PERL5LIB to $HOME/sausr/local/lib:$HOME/sausr/local/lib/perl/5.6.1/
but that didn’t make any difference…