Howtoforge posted a guide about setting up Ubuntu server as spamfilter
>> The Perfect SpamSnake - Ubuntu Jaunty Jackalope
This tutorial shows how to set up an Ubuntu Jaunty Jackalope based server as a spamfilter in Gateway mode. In the end, you will have a SpamSnake Gateway which will relay clean emails to your MTA. You will also be able to view your incoming queue, train your SpamSnake and carry out a few more advanced operations via MailWatch.
>> The Perfect SpamSnake - Ubuntu Jaunty Jackalope