This howto assumes you have a mailer based on Ivar Abrahamsen's tutorial "How to set up a mail server on a GNU / Linux system". I'll describe one way to add Mailman to your system. I'm sure there are better ways to do this -- if you know of any, please let me know.
Rich Brown, chief cook and bottle washer, FreeMars.org
Draft - Started 17 December 2005
Released to the unsuspecting world - 21 December 2005
Latest minor revision -
14 April 2008 at 06:05 PM

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
It's all about choices. Open Source / Libre software often has simalar projects with slight differences in emphasis; my selection of software might not be right for your site. If you think Ubuntu + Postfix + Mailman is right for you, great. Or if you can pick any helpful information from this page and apply it to your software selection, great. Otherwise, sorry to have wasted your time.
After I abandoned Windows I settled on Red Hat for quite a while. It helped to have a relative who worked for the company (free tech support!) I've poked around with other distributions here and there and found some nice things in each. Here and there I seriously considered switching to SuSE (now SUSE from Novell) and Mandrake (now Mandriva) -- each was a slick distribution, but each had some things which were annoyingly different than what I was used to, i.e. the Red Hat way.
Eventually the folks at Red Hat decided to put all their eggs in their professional line and spun off the personal version as Fedora Core. Fedora was and is still a great distribution, but I started feeleing a bit like a guinnea pig for Red Hat Enterprise. It was time to go shopping again. Fedora Core has come a long way since I left the Red Hat camp; I've been reading great stuff about the recent releases. By now, of course, I'm used to the Debian/Ubuntu way. Such is life.
Ubuntu turned out to have a lot of things I liked -- a strong freeware mentality, active user support, rapid response to security flaws, nice fit-and-finish. Package control is extremely easy with apt-get and/or Synaptic.
The Mailman has a nice collection of features -- web-based controls for both users and administrators, lots of configuration options, good spam controls. This one package can provide you with hidden mailing lists just for your friends and public lists to which anyone who visits your site can subscribe.
One great feature of Mailman is the ability to assign others to keep track of mailing lists without giving them enough power to trash your entire system.
Let's get started.
If you don't have at least Postfix and MySQL installed as described here, stop. I'm describing a non-standard install. You might want to follow these instructions instead.
There is only one package you'll need to add - mailman. Use Synaptic Package Manager or apt-get to add it to your machine.
Your computer will have a new user - list - and a new group - list - and many files in the following directories:
/usr/lib/mailman/
/usr/lib/cgi-bin/mailman/
/usr/share/doc/mailman/
/usr/log/mailman/
/var/lib/mailman/
/var/lock/mailman/
/var/run/mailman/
/etc/mailman/
/etc/init.d/
/usr/sbin/
It's my belief the Ubuntu install files leave you with the wrong file ownerships, so if you haven't already opened a terminal window do so and become root
$ sudo -s (and enter your password)
Mailman includes a handy script to make check your permissions. It's in /usr/sbin/ so it should be on root's path.
# check-perms
- and note the massive problems. To fix permissions,
# check-perms -f
A bunch of changes scroll by, but did it get them all?
# check-perms -f
Nope; still errors. In fact, you need to
# cd /var/lib/mailman
# chown list:list *
Of course I'm using example.com for this HOWTO. Substitute your own domain name.
The Mailman configuration files are in /etc/mailman. Use your favorite text editor to edit /etc/mailman/mm_cfg.py. You'll want to check/edit/add the following lines:
MTA=None # No MTA processing req'd for Ubuntu/virtual/postfix-to-mailman.py
IMAGE_LOGOS = '/mmimages/'
DEFAULT_EMAIL_HOST = 'example.com'
DEFAULT_URL_HOST = 'example.com'
I'm not sure if you need this line - can someone tell me?
DEB_LISTMASTER = 'postmaster@example.com'
Note: Some versions of Ubuntu (and Debian) may also require a single-character in /etc/postfix/master.cf in order to give Mailman the permissions it needs. If your version of this file has a line that looks like this:
mailman unix - - n - - pipe
change it to this:
mailman unix - n n - - pipe
See Debian bug 315939
Thanks to Lars Rahm at the American Overseas School of Rome for pointing this out.
Apache 2 config files are in /etc/apache2. The Apache authors think you should put anything that looks like a module in mods-available and mods-enabled. Go ahead and create a new file: /etc/apache2/mods-available/mailman.conf
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>
Optional - pipermail is one of those directory names which hangs around for historical reasons but makes little sense to users. You might want to add a more sensible-sounding alias for the mailing list archives.
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
Configuration files for Postfix are in /etc/postfix. For a change, there are a couple files to edit in this directory.
Let's start by creating a new file, /etc/postfix/transport, which contains one line:
lists.example.com mailman:
What we've just done is create a fake computer name - lists.example.com - which we can use to help Postfix sort mailing list messages from normal emails. This will be a hash, so as root:
# cd /etc/postfix
# postmap transport
(There now should be a file named transport.dd in the directory.) Mailman is a stock transport type which your copy of Postfix should already be configured to handle. To make sure this is the case check /etc/postfix/master.cf and confirm that it contains:
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
Finally edit /etc/postfix/main.cf - add these three lines to the end of the file:
relay_domains = lists.example.com
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1
All your configuration files are now set. Activate everything by restarting your services:
# /etc/init.d/apache2 restart
# /etc/init.d/postfix reload
# /etc/init.d/mailman start
Mailman doesn't have anything to do until there is at least one list for it to act on, so let's make one:
# newlist mailman
You'll be asked for an administrator email address - give it yours - and a password. If all goes well you should immediately get an email welcoming you to your new list. The email will have a URL where you can go and experiment with the web-based mailman configuration. There's just one thing that won't work -- emails sent to the list will not work. On to the final section of this howto.
If you've installed phpmyadmin as Ivar suggests you can use a GUI interface, otherwise you'll edit your MySQL database through the command line. Insert the following entries into the aliases table of the maildb database:
| destination | |
|---|---|
| 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 |
Your 'mailman' list should be operational.
Counter: