I am a big fan of the cut-and-paste howtos provided at howtoforge.com.
I’ve used something like falko’s howto on Virtual Users And Domains With Postfix, Courier, MySQL And SquirrelMail (Ubuntu 10.10) in order to get a mail server with those features working on Debian Squeeze.
Then I wanted to add mailman in order to operate mailing lists.
The closest howto for achieving this is the one by Rich Brown, How to add Mailman mailing lists to Postfix under Ubuntu Linux when using virtual domains + virtual users.
I’m going to try to recount what I had to do to go from a working mail server with virtual users and domains (having completed a howtoforge.com howto) to get to that same setup to run mailman. Perhaps some of this was unnecessary, duplicative, or even wrong. But, the mailing lists are working now, so that’s something.
List domain preparation
If the domain that will host the lists is not already served by your setup, be sure you:
- use phpmyadmin to create the domain example.com in the domains field. NOT lists.example.com!, and
- add lists.example.com to your dns entry for example.com,
Mailman
As root:
# aptitude install mailman
# newlist mailman
# vi /etc/aliases
And add the following to /etc/aliases:
## mailman mailing list mailman: "|/var/lib/mailman/mail/mailman post mailman" mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/var/lib/mailman/mail/mailman join mailman" mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman" mailman-request: "|/var/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
# vi /etc/mailman/mm_cfg.py
and uncomment and/or appropriately edit the following lines:
DEFAULT_EMAIL_HOST = 'lists.example.com' ... DEFAULT_URL_HOST = 'lists.example.com' ... MTA=None # Misnomer, suppresses alias output on newlist ... GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
Apache2
create a new file: /etc/apache2/mods-available/mailman.conf that looks like this:
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/ ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/ <Directory /usr/lib/cgi-bin/mailman/> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> Alias /pipermail/ /var/lib/mailman/archives/public/ <Directory /var/lib/mailman/archives/public> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> Alias /archives/ /var/lib/mailman/archives/public/ <Directory /var/lib/mailman/archives/public> Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory>
Now add a symlink to this file so Apache will use your new Mailman aliases the next time it starts:
# cd /etc/apache2/mods-enabled
# ln -s /etc/apache2/mods-available/mailman.conf mailman.conf
Postfix
Create a new file, /etc/postfix/transport, which contains one line:
lists.example.com mailman:
Then as root:
# cd /etc/postfix
# postmap transport
Finally edit /etc/postfix/main.cf – add these four lines to the end of the file:
relay_domains = lists.example.com
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1
unknown_local_recipient_reject_code = 550
Use phpmyadmin to add some aliases in the forwardings field:
mailman@example.com mailman@lists.example.com mailman-admin@example.com mailman-admin@lists.example.com mailman-bounces@example.com mailman-bounces@lists.example.com mailman-confirm@example.com mailman-confirm@lists.example.com mailman-join@example.com mailman-join@lists.example.com mailman-leave@example.com mailman-leave@lists.example.com mailman-owner@example.com mailman-owner@lists.example.com mailman-request@example.com mailman-request@lists.example.com mailman-subscribe@example.com mailman-subscribe@lists.example.com mailman-unsubscribe@example.com mailman-unsubscribe@lists.example.com
Finishing up
# newaliases
# service apache2 restart
# postfix reload
# service mailman start
After some combination of the above and hopefully not forgetting anything–note my uncertainty there–mailing lists just started working! Go to: http://lists.example.com/mailman/admin/ and get started creating a test list to confirm everything is working.
