How to setup SpamBayes
Login | Register RSS

This introduction was built to address installing and getting started with SpamBayes POP3 proxy on Fedora Core 1 & like Linux operating systems [e.g. Redhat 9, Yellow Dog, etc...]

This process will cover:

  1. downloading the necessary files
  2. installing Python & SpamBayes
  3. starting spambayes manually
  4. configuring spambayes & your email client
  5. setup a script to start & stop spambayes as we login/logout

*** IMPORTANT NOTES ***
- My steps below assume you're using a stock setup of Fedora Core 1 Linux or like system
- your Linux box has been kept updated using one of the many package management solutions (e.g. up2date, yum, apt, etc...)
- you have root access to the Linux box you are using
- your setting up SpamBayes for a POP3 email account
- you will be the sole user of the spambayes POP3 proxy

With that out of the way, on with the show...

Downloading the necessary files:

At the time of this writing the following are the newest versions of spambayes & python available. You will need to download the following files from the below locations:
- Spambayes v1.0a9 -- http://prdownloads.sourceforge.net/spambayes/spambayes-1.0a9.tar.gz?download
- Python 2.3.2 -- http://www.python.org/ftp/python/2.3.3/Python-2.3.3.tgz

Installing Python & SpamBayes
Open a terminal session as root.
change directory to where you saved these files
we'll start with unpacking, building & then installing the new version of Python (fedora core currently offers Python 2.2, while Python 2.3 is required by spambayes to correctly process some statistics features.)
Unpack it with "tar -zxvf Python-2.3.3.tgz".
Change directory into the Python-2.3.3 directory and run the "./configure" command [minus the quotes]. This self configures the make program so it can properly build python on your system.
Then run the "make" command [minus the quotes]. The builds python on your system & makes it ready to install.
Then run the "make install" command to finish compiling and to install Python
you can safely delete the Python-2.3.3 folder and its contents once your python installation is complete... Now that its installed, it is no longer needed.

we then turn our sights twords actually installing spambayes.
we'll start with unpacking spambayes. Change directory to where you saved the downloaded spambayes file.
Unpack it with "tar -zxvf spambayes-1.0a9.tar.gz".
change directory into the spambayes-1.0a9 directory
then run the "python setup.py install" command [minus the quotes] to install spambayes to your system
now that things are installed, you can clean up the mess.
you can safely delete the spambayes-1.0a9 folder and its contents... Now that its installed, it is no longer needed.

starting spambayes manually

you need to start it up as your intended every-day user.
logout as root and login with your normal day-to-day username
open a terminal window (you should be in your home directory)
then run the "sb_server.py -b &" command [minus the quotes] to manually start up spambayes. This will initilize it necessary data files in your home directory
you won't actually get a prompt, but it is safe to close the terminal window

configuring spambayes & your email client
To configure SpamBayes, open your brower and go to "http://localhost:8880"; this points to your running spambayes POP3 proxy
click on the "Configuration" link at the top right
fill in the POP3 & SMTP mail server domains
set the POP3 port to '1110' & set the SMTP port to 1025.
everything should be OK with the defaults
click the 'Save' button at the bottom of the page & your done with your browser

in your email program setup your POP3 & SMTP server use the same settings for your email account as usual; with 2 slight exceptions.
setup your POP3 server domain as 'localhost', using port '1110'
setup your SMTP server domain as 'localhost', using port '1025'
if your email client does not let you enter a port, setup the domain as DomainName:Port# (e.g. 'localhost:1110')
your done setting up your email client...

setup a script to start & stop spambayes as we login/logout

you will find an attached script (download it here). Save as a '.pl' file.
Set it up in your home folder & adjust it as necessary (such as your home path & username)
use your crontab it run the 'auto' command every few minutes (every 5 minutes is ok) & dump anything it prints to /dev/null (e.g. the entry in your crontab would look like this "*/5 * * * * /home/username/spambayes.pl auto > /dev/null")
this script will work like any service, using 'script_name mode' format.
available modes are 'start', 'stop', 'restart' & 'auto' (the first 3 are self explanatory, while 'auto' in intended to automatically startup/shutdown the proxy whenever the user is logged in/out on the main terminal)

your done... the crontab and script will do the work to start/stop the proxy by your logging in/out.
to train your email after they get downloaded, you can go "http://localhost:8880" and use the 'review messages' link to train.
all other tweaking and rules necessary for the specific method to pass the ham/spam/unsure message to your email client is up to you. I use evolution and set a filter to check the subject line for 'spam' to tell me when to move the mail to my trash folder.

If you like this site or any of its content, please help promote it. Use the social media buttons below to help spread the word. Don't forget to post in the comments section.

  Print   Email