How To Install And Configure Mailman On Ubuntu

In this tutorial I will configure a virtual host with the hostname lists.example.com where I will install Mailman. lists.example.com is also the right part of the mailing list email addresses that will be configured in Mailman, i.e., mails to a mailing list will have to be sent to the address <listname>@lists.example.com.

As your hostname will be different, please adjust this tutorial accordingly. Also make sure that your hostname exists in DNS.

Mailman can be used with many mail servers (e.g. Postfix, Exim, Sendmail, Qmail). I will use Postfix in this tutorial. Make sure you have a working Postfix installation.

Installing Mailman And Apache

As Mailman comes with a web frontend, thus need a web server in addition to Mailman. I choose Apache. Mailman and Apache can be installed as follows:

Mailman needs a so-called “site list”, which is the list from which password reminders and such are sent out from. This list needs to be created before mailman will start. To create the list, run

and follow the instructions on-screen. Note that you also need to start mailman after that, using

Mailman comes with an Apache configuration file, /etc/mailman/apache.conf, which we copy to /etc/apache2/sites-available/mailman.conf:

Open /etc/apache2/sites-available/mailman.conf

… and append the following vhost configuration to the file (there’s already a vhost for lists.example.net in the file which is commmented out – please don’t use that vhost as my vhost configuration differs a little bit although it looks quite similar):

 

The second to last line ScriptAlias / /usr/lib/cgi-bin/mailman/listinfo is optional; it makes that when you go to http://lists.example.com/, you will be redirected to http://lists.example.com/listinfo. This makes sense if you don’t have any files to serve in the document root /var/www/lists.

Next create the document root /var/www/lists, enable the lists.example.com vhost configuration and restart Apache:

Because we are using a vhost here (lists.example.com), we need to adjust the following variables in /etc/mailman/mm_cfg.py:

Configuring Postfix

Now we need to configure Postfix. First run:

Then open /etc/postfix/master.cf

… and make sure you have the following lines in it (they should be there by default):

Next we must associate the lists.example.com domain to the mailman: transport. How you do this depends on your Postfix configuration. Transports can be stored in a MySQL database or, like in most setups, the file /etc/postfix/transport is used for creating transports. Both cases are described below

Transports In A MySQL Database

To create the necessary transport, log into MySQL…

… and run the following MySQL commands:

Restart Postfix afterwards:

Transports In /etc/postfix/transport

If you don’t have your transport in a MySQL database, you probably use the file /etc/postfix/transport. In this case you can set up the necessary transport as follows:

Open /etc/postfix/transport

 … and add the following line:

Run

afterwards and restart Postfix:

Creating The mailman Mailing List

Before we can start to use Mailman, we must create a mailing list called “mailman”; this is obligatory – without it Mailman won’t start:

In most cases the –urlhost and –emailhost switches are not necessary because our vhost is already named lists.example.com, and we also have it in /etc/mailman/mm_cfg.py (DEFAULT_EMAIL_HOST and DEFAULT_URL_HOST), but if you want to go sure that Mailman uses the correct hostname, use these switches.

Enter the email of the person running the list: <– specify the list administrator email address Initial mailman password: <– mailman_password

To finish creating your mailing list, you must edit your /etc/aliases (or
equivalent) file by adding the following lines, and possibly running the
`newaliases’ program:

Hit enter to notify mailman owner… <– ENTER

Now open /etc/aliases and add the aliases that you see in the output of the newlist command (this has to be done manually for each new list that you create):

 

Whenever you modify /etc/aliases, you need to run

afterwards.

Now we can finally start Mailman:

Be sociable 🙂 Share!

Comments/Коментарі/Комментарии