Version 4 (modified by maia@…, 16 years ago) (diff) |
---|
Setting up bayes with SpamAssassin 3.x, using a MySQL database
Bits taken from the mailing list and Paul Westbrook's experiences.
You can find the database definitions for AWL and bayes here: http://spamassassin.apache.org/full/3.0.x/dist/sql/ (or as part of your 3.0 package).
If you are using MySQL 4.x, I would advise you to change the tables from type MyISAM to InnoDB to improve the locking speed.
Create the tables required with commands such as the following:
- mysql -u root maia -p < awl_mysql.sql
- mysql -u root maia -p < bayes_mysql.sql
Backup up the bayesian databases with a command like the following: sa-learn --backup > backup.txt
Next, add the following lines to the file ~amavis/.spamassassin/user_prefs
#--userprefs-- use_bayes 1 bayes_store_module Mail::SpamAssassin::BayesStore::SQL bayes_sql_dsn DBI:mysql:maia bayes_sql_username maia bayes_sql_password YourMaiaPass auto_whitelist_factory Mail::SpamAssassin::SQLBasedAddrList user_awl_dsn DBI:mysql:maia user_awl_sql_username maia user_awl_sql_password YourMaiaPass #--end userprefs---
Add the bayes database to the newly created SQL tables: sa-learn --restore < backup.txt
Test that SpamAssassin can connect to the bayes SQL database:
amavis:$ spamassassin -tD < sample-spam.txt 2>&1 |grep Database debug: bayes: Database connection established
If you see output such as the above, restart amavisd-new. Your Amavisd-Maia / SpamAssassin 3 installation should now be set-up to use SQL based bayes. Congrats. :)