Contributed by Ted Mittelstaedt on the SpamAssassin Users mailing list

Note that the Ubuntu packager modified all of the prefixes.

So just downloading it and compiling the latest version will put it in /usr/local/sbin instead of /usr/sbin and so on for all the other locations.

1. Install Ubuntu Server and configure to ssh into it, static IP, add name to /etc/hosts, ntp time sync it, set correct timezone, hostname, forward and reverse dns records, setup backups, update, etc.

2. Install Sendmail:

apt-get install sendmail

  3.  Run the (Ubuntu-specific)  script

sendmailconfig

  4.  Test local delivery: 


# /usr/sbin/sendmail username
From: username@localhost
Subject: test

test
.

And confirm the delivery:

cat /var/mail/username


5. Add the IP address on your machines interface you want your machine to receive mail on to Sendmail's configuration in /etc/mail/sendmail.mc:

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=86.75.30.9')dnl

     And Build sendmail.cf:

cd /etc/mail

make

 /etc/init.d/sendmail reload

7. Test from another host make sure you are getting mail. 

8. Install and start Spamassassin: 

apt install spamassassin
 systemctl enable spamd

cd /etc/spamassassin
 cp  local.cf  local.cf.installed
 vi local.cf

(make your configuration changes and save)

 systemctl start spamd

9. Create m4 template snippet for SpamAssassin:

cd /etc/mail
mkdir -p /etc/mail/spamassassin

vi /etc/mail/spamassassin/spamassassin.m4

Put in:

dnl
dnl Process mail through spamassassin
dnl
define(`confMILTER_MACROS_ENVFROM', `i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}, r, b, v, Z')dnl
define(`confMILTER_MACROS_ENVRCPT', `{auth_type}, r, v, Z')dnl
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass/spamass.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl

10. Add this template to the main sendmail.mc

cd /etc/mail
 cp sendmail.mc sendmail.mc.nospamassassin

 vi sendmail.mc

Add:

include(`/etc/mail/spamassassin/spamassassin.m4')dnl

right before MAILER_DEFINITIONS  and save

11. Re-run sendmailconfig

12. Install, enable, and start spamass-milter

service spamd stop

apt-get install spamass-milter

cd /etc/default

vi spamass-milter

uncomment and modify:

SOCKETOWNER="spamass-milter:spamass-milter"

save that file and enable+start the milter:

systemctl enable spamass-milter

service spamd start

 systemctl start spamass-milter




As of this writing (2026-04-17)  the Ubuntu packages install correct config/default files for systemctl and so on

The spamassassin package is version 4.0.2

https://packages.ubuntu.com/noble/spamassassin

The spamass-milter is version 0.4.0

https://packages.ubuntu.com/noble/spamass-milter

Sendmail is version 8.18.1-2

https://packages.ubuntu.com/noble/mail/sendmail