(NOTE: this is part of the “An Anti-Spam gateway” series)
Time for MySQL. We’ll be using it just for storing the bayes tokens, not for per-user configuration (because, in this case, there is none) or anything else.
Note: if you already have a working MySQL on the server, being used for something else (this isn’t Windows, you can use the same machine for several different things ), just skip to the next part.
So, go to http://dev.mysql.com/downloads/, choose the General Availability Release (it’s the top one – at this moment, it’s version 5.0), then scroll down a lot until you find the Source Downloads. Get the .tar.gz file. Uncompress it, enter the directory, and then…
export CFLAGS="-O2"
export CXXFLAGS="-O2 -fno-exceptions -fno-rtti"
./configure --prefix=/usr/local --localstatedir=/var/mysql --sysconfdir=/etc --without-innodb
(note: your browser may have split the “./configure” line in two. It starts with “./configure”, and ends with “–without-innodb”.)
then do the usual
make
make install
If everything went well,
mysql_install_db
and start the server with:
mysqld_safe --user=mysql &
Then assign a password to the MySQL root
account (which is not the OS’s root account!):
mysqladmin -u root password "newpwd"
mysqladmin -u root -h host_name password "newpwd"
Replace “host_name” with the correct one, and “newpwd” with something else, of course.
Now, for efficiency, you should have an /etc/my.cnf
file with several options set manually. The MySQL sources include some examples in the support-files
directory: my-small.cnf
, my-medium.cnf
, etc.. Copy one to /etc/my.cnf
, edit it, then restart the server. Nope, I won’t give detailed instructions for that here… read the MySQL docs at http://www.mysql.com.
Next: how to create the bayes database, and how to configure SpamAssassin to use it.
Copyright © 2013 The Tlog - a technology blog