how to configure Mailman on a virtual host
This article will show you how to configure Mailman on a virtual host. It assumes the following:
- You are running Ubuntu 10.04 (the Lucid Lynx).
- Postfix has been successfully configured for ordinary use.
- Apache has been successfully configured with virtual hosts.
After you are finished, you will have an attractive Mailman installation and be able to create and manage as many mailing lists as you please.
Contents |
Install Mailman.
First, install Mailman using the following command:
sudo aptitude install mailman
As the installation proceeds, you will be asked for an installation language. Select as many languages as you wish to support.
Create Mailman list.
To run, Mailman needs a master list. Create one using the following command:
sudo newlist mailman
Answer the prompts, which should be self-explanatory.
When you are finished, you will be advised of the need to add a list of aliases to your mailing system. Open your aliases file:
sudo nano /etc/aliases
Add the following lines to the end of the file:
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"
Save, exit, and cause the aliases file to be reprocessed by issuing the following command:
newaliases
Start the Mailman service.
A critical component of Mailman runs as a service. It's time to start it up:
sudo /etc/init.d/mailman start
If all has gone well up to this point, your Mailman back-end has been successfully configured.
Make Mailman's web address more friendly.
Mailman provides a web interface to assist in list management. Unfortunately, the URL to access this web interface contains a path component ("cgi-bin") that is meaningless to the average non-geek user. There is no need for this, and leaving it in is bad form (in the 21st century). However, if you really don't care, you can skip this step.
To pretty up the URL, begin by editing Mailman's Apache configuration file:
sudo nano /etc/mailman/apache.conf
Find the section that reads:
#ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
Uncomment, save, and exit.
Next, edit the Mailman configuration file.
sudo nano /etc/mailman/mm_cfg.py
Find the line that reads:
DEFAULT_URL_PATTERN = 'http://%s/cgi-bin/mailman/'
Remove the substring, "cgi-bin/".
Save and exit.
Enable the web interface.
Open up the virtual host configuration file for the site where you want to enable the Mailman web interface.
sudo nano /etc/apache2/sites-available/<your site>.conf
Insert the following line within the VirtualHost section:
Include /etc/mailman/apache.conf
Save and exit.
Restart Apache to read the new configuration.
Test the web interface by browsing to the following URL:
http://<yourdomain>/mailman/admin
A very simple web interface should appear, showing Mailman as the only available mailing list. If this is what you see, you have successfully configured Mailman's web interface.
Customize Mailman to your liking.
You can use the web interface to customize Mailman according to your own preferences. Sharky recommends hiding and locking down the Mailman list from public view until you've decided how you want to use your new software and created all your mailing lists.
To lock down the Mailman list, enter the Mailman administration site and choose Privacy options...
Set the following properties:
property | value |
---|---|
advertised | No |
subscribe_policy | Confirm and approve |
private_roster | List members |
Save your changes by pressing the Submit Your Changes button.
Create your mailing lists.
You are now free to begin creating your mailing lists. To create your lists, the following commands will be helpful:
command | function |
---|---|
newlist | add a new list |
rmlist <listname> | delete a list |
list_lists | list all the lists |
list_members <listname> | list all the members of the list |
add_members <address1> <address2> ... <listname> | add e-mail addresses to list |
remove_members <address1> <address2> ... <listname> | remove email addresses from list |
You can direct your audience to the following URL to view available lists.
http://<yourdomain>/mailman/listinfo
From this page, they can subscribe to lists and manage their preferences.