Mailman is an open source program for managing electronic mail discussions and e-newsletter lists. Many open source mailing lists (including all the Ubuntu mailing lists) use Mailman as their mailing list software. It is powerful and easy to install and maintain.
Mailman provides a web interface for the administrators and users. So, it requires apache with mod_perl support. Mailman uses an external mail server to send and receive emails. It works perfectly with the following mail servers:
-
Postfix
-
Exim
-
Sendmail
-
Qmail
We will see how to install mailman, the apache web server and the Exim mail server. If you wish to install mailman with a different mail server, please refer to the references section.
To install apache2 you refer to HTTPD Installation section for details.
To install Exim4 you run the following commands at a terminal prompt:
sudo apt-get install exim4
sudo apt-get install exim4-base
sudo apt-get install exim4-config
Once exim4 is installed, the configuration files are stored in
the /etc/exim4
directory. In Ubuntu, by default, the exim4 configuration files are
split across different files. You can change this behavior by changing
the following variable in the /etc/exim4/update-exim4.conf
file:
-
dc_use_split_config='true'
To install Mailman, run following command at a terminal prompt:
sudo apt-get install mailman
It copies the installation files in /var/lib/mailman directory. It installs the CGI scripts in /usr/lib/cgi-bin/mailman directory. It creates list linux user. It creates the list linux group. The mailman process will be owned by this user.
This section assumes you have successfully installed mailman, apache2, and exim4. Now you just need to configure them.
Once apache2 is installed, you can add the following lines in
the /etc/apache2/apache2.conf
file:
Alias /images/mailman/ "/usr/share/images/mailman/"
Alias /pipermail/ "/var/lib/mailman/archives/public/"
Mailman uses apache2 to render its CGI scripts. The mailman CGI scripts
are installed in the /usr/lib/cgi-bin/mailman
directory. So, the mailman url will be
http://hostname/cgi-bin/mailman/. You can make changes to the
/etc/apache2/apache2.conf
file if you wish to
change this behavior.
Once Exim4 is installed, you can start the Exim server using the following command from a terminal prompt:
sudo apt-get /etc/init.d/exim4 start
In order to make mailman work with exim4, you need to configure exim4. As mentioned earlier, by default, exim4 uses multiple configuration files of different types. For details, please refer to the Exim website. To run mailman, we should add new a configuration file to the following configuration types:
-
Main
-
Transport
-
Router
Exim creates a master configuration file by sorting all these mini configuration files. So, the order of these configuration files is very important.
All the configuration files belonging to the main type are
stored in the
/etc/exim4/conf.d/main/
directory. You can add
the following content to a new file, named 04_exim4-config_mailman
:
# start
# Home dir for your Mailman installation -- aka Mailman's prefix
# directory.
# On Ubuntu this should be "/var/lib/mailman"
# This is normally the same as ~mailman
MM_HOME=/var/lib/mailman
#
# User and group for Mailman, should match your --with-mail-gid
# switch to Mailman's configure script. Value is normally "mailman"
MM_UID=list
MM_GID=list
#
# Domains that your lists are in - colon separated list
# you may wish to add these into local_domains as well
domainlist mm_domains=hostname.com
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# These values are derived from the ones above and should not need
# editing unless you have munged your mailman installation
#
# The path of the Mailman mail wrapper script
MM_WRAP=MM_HOME/mail/mailman
#
# The path of the list config file (used as a required file when
# verifying list addresses)
MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
# end
All the configuration files belonging to transport type are stored in
the /etc/exim4/conf.d/transport/
directory. You
can add the following content to a new file named
40_exim4-config_mailman
:
mailman_transport:
driver = pipe
command = MM_WRAP \
'${if def:local_part_suffix \
{${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
{post}}' \
$local_part
current_directory = MM_HOME
home_directory = MM_HOME
user = MM_UID
group = MM_GID
All the configuration files belonging to router type are stored in the
/etc/exim4/conf.d/router/
directory. You can add the following content
in to a new file named 101_exim4-config_mailman
:
mailman_router:
driver = accept
require_files = MM_HOME/lists/$local_part/config.pck
local_part_suffix_optional
local_part_suffix = -bounces : -bounces+* : \
-confirm+* : -join : -leave : \
-owner : -request : -admin
transport = mailman_transport
The order of main and transport configuration files can be in any order. But, the order of router configuration files must be the same. This particular file must appear before the 200_exim4-config_primary file. These two configuration files contain same type of information. The first file takes the precedence. For more details, please refer to the references section. |
Once mailman is installed, you can run it using the following command:
sudo /etc/init.d/mailman start
Once mailman is installed, you should create the default mailing list. Run the following command to create the mailing list:
sudo /usr/sbin/newlist mailman
Enter the email address of the person running the list: bhuvan at ubuntu.com
Initial 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:
## 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"
Hit enter to notify mailman owner...
#
We have configured exim to recognize all emails from mailman. So, it is
not mandatory to make any new entries in
/etc/aliases
. If you have made any changes
to the configuration files, please ensure that you restart those
services before continuing to next section.
We assume you have a default installation. The mailman cgi scripts are still in the /usr/lib/cgi-bin/mailman/ directory. Mailman provides a web based administration facility. To access this page, point your browser to the following url:
http://hostname/cgi-bin/mailman/admin
The default mailing list, mailman, will appear in this screen. If you click the mailing list name, it will ask for your authentication password. If you enter the correct password, you will be able to change administrative settings of this mailing list. You can create a new mailing list using the command line utility (/usr/sbin/newlist). Alternatively, you can create a new mailing list using the web interface.
Mailman provides a web based interface for users. To access this page, point your browser to the following url:
http://hostname/cgi-bin/mailman/listinfo
The default mailing list, mailman, will appear in this screen. If you click the mailing list name, it will display the subscription form. You can enter your email address, name (optional), and password to subscribe. An email invitation will be sent to you. You can follow the instructions in the email to subscribe.