Linux Step By Steps

MAIL: Building and Installing Mailman

By: Kurt Wall

Tested on: Slackware 8.1


Assumptions

The instructions for configuring and installing Mailman in this document make the following assumptions:

Process

This is the process I used to install and configure Mailman at KurtWerks. As usual, your mileage may vary and if it breaks, you get to keep all three pieces. The process is somewhat involved, but I've tried to simplify it as much as possible and keep the discussion of theory to a minimum.

  1. Create a mailman user and group:
     
        # groupadd mailman
        # useradd -d /usr/local/mailman -g mailman mailman
        

    I created the group first so that I could specify it using the useradd's -g option when I created the user.

  2. Create the home directory, which is the directory into which Mailman will be installed:
        # mkdir /usr/local/mailman
        
  3. The home directory must be owned by group mailman and readable and executable by the world and must also be setGID:
        # cd /usr/local/mailman
        # chgrp mailman .
        # chmod 2775 .
        # ls -ld
        drwxrwsr-x    2 root     mailman      4096 Jan  3 08:47 ./
        
  4. If you haven't already, download the software (mailman-2.1.tar.gz, or whatever the latest version is). I used ftp.gnu.org/gnu/mailman/.
  5. Unpack the archive. As remarked at the top of this document, I build in /tmp as a mortal user:
        $ cd /tmp
        $ gzip -cd mailman-2.1.tar.gz | tar -xf -
        
  6. Configure Mailman. The key values you'll need to know are the group that runs CGI scripts for your Web server, the group that should run Mailman's wrapper scripts, and the extension to add to the CGI scripts. For me, these values were nobody, daemon, and .cgi, respectively:
     
        $ ./configure --with-cgi-gid=nobody \
                      --with-mail-gid=daemon \
                      --with-cgi-extension=".cgi" 
        [...]
        configuration completed at Sat Jan 4 12:09:04 EST 2003
        $ make
        [...]
        

    If you are running Apache, the group that runs CGI scripts and which corresponds to the --with-cgi-gid option passed to configure is specified by the Group directive in the httpd.conf. I had some trouble identifying the argument to pass to --with-mail-gid, which specifies the group that should run Mailman's wrapper scripts, but it turned out to be daemon.

  7. Install the newly configured Mailman. There is very little that actually gets compiled because Mailman is mostly Python. Note that the actual installation must be performed by the root user:
        # make install
        [...]
        
  8. Validate the installation:
        # cd /usr/local/mailman
        # bin/check_perms
        No problems found
        
    If the check_perms script reports errors, rerun it using the -f option to fix the errors.
        # bin/check_perms -f
        

    If check_perms can't fix the errors, you'll have to RTFM at the Mailman site or in the distribution tarball to diagnose and solve them yourself.

  9. Configure your Web server to allow execution of CGI scripts in /usr/local/mailman/cgi-bin. If you are running Apache, it should be sufficient to add the following directive to the Apache configuration file, httpd.conf:
        ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
        
  10. Copy the Mailman, Python, and GNU logos to a location accessible to the Web server. For example, if the directory in which Apache looks for icons is /var/www/icons, the following command should do:
        # cp $prefix/icons/*.{jpg,png} /var/www/icons
        
    Edit /usr/local/mailman/Mailman/mm_cfg.py and add a line that points the variable IMAGE_LOGOS points at the proper base URL for the logos you've just copied into place. At KurtWerks, the base URL is /icons/ under the document root, so the value is:
        IMAGE_LOGOS = '/icons/'
        
  11. Point your Web server at the public mailing list archives. Using Apache, the following lines added to httpd.conf should do:
          Alias /pipermail/ "/usr/local/mailman/archives/public/"
          <Directory "/usr/local/mailman/archives/public">
              Options FollowSymLinks
          </Directory>
        
  12. Restart Apache. I use apachectl restart, which should work for most Apache installations, but you might want to use the appropriate init script.
        # apachectl restart
        /usr/sbin/apachectl restart: httpd restarted
        
  13. Mailman relies on a number of cron jobs to provide much of its functionality, so the next step is to install the mailman user's crontab entries. The Mailman distribution contains a prebuilt crontab file, /usr/local/mailman/cron/crontab.in, which can be installed with the following command:
        # crontab /usr/local/mailman/cron/crontab.in -u mailman
        
  14. Start Mailman's queue runner daemon:
        # bin/mailmanctl start
        Starting Mailman's master qrunner.
        
  15. To ensure that Mailman starts automatically when the system reboots, add its initialization script to your init script system. For simplicity's sake, I added an invocation of the script to rc.local -- the Mailman INSTALL file lists other means of integrating the script into system startup scripts. Here are the lines I added to rc.local:
        # Start Mailman
        /usr/local/mailman/scripts/mailman start
        
    Similarly, I wanted Mailman to stop automatically when the system is shutdown, so I added the following lines to /etc/rc.K:
        # Stop Mailman
        if [ -x /usr/local/mailman/scripts/mailman ] ; then
            /usr/local/mailman/scripts/mailman stop
        fi
        
  16. Review the entries for DEFAULT_EMAIL_HOST and DEFAULT_URL_HOST in /usr/local/mailman/Mailman/Defaults.py. DEFAULT_EMAIL_HOST should contain the hostname portion of email sent to your domain. So, if an email address is you@some.where, DEFAULT_EMAIL_HOST should be some.where. Similarly, if the URL people type to view your Web pages is www.some.where/somepage.html, then DEFAULT_URL_HOST would be www.some.where. If you need to change either of these values, change them in /usr/local/mailman/Mailman/mm_cfg.py, and add the line add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST) to the same file. At KurtWerks, for example, I made the following changes to /usr/local/mailman/Mailman/mm_cfg.py:
        DEFAULT_EMAIL_HOST = 'kurtwerks.com'
        DEFAULT_URL_HOST = 'www.kurtwerks.com'
        add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
        
  17. Use the newlist script to create the mailman mailing list. This list is the one from which password reminders will appear to originate. Execute the command bin/newlist mailman and follow the prompts:
        # bin/newlist mailman
        Enter the email of the person running the list: kwall@kurtwerks.com
        Initial mailman password: 
    
        To finish creating your mailing list, you must edit your
        /etc/mail/aliases (or equivalent) file by adding the
        following lines, and possibly running the newaliases
        program:
    
        ## mailman mailing list
        mailman:              "|/usr/local/mailman/mail/mailman post mailman"
        mailman-admin:        "|/usr/local/mailman/mail/mailman admin mailman"
        mailman-bounces:      "|/usr/local/mailman/mail/mailman bounces mailman"
        mailman-confirm:      "|/usr/local/mailman/mail/mailman confirm mailman"
        mailman-join:         "|/usr/local/mailman/mail/mailman join mailman"
        mailman-leave:        "|/usr/local/mailman/mail/mailman leave mailman"
        mailman-owner:        "|/usr/local/mailman/mail/mailman owner mailman"
        mailman-request:      "|/usr/local/mailman/mail/mailman request mailman"
        mailman-subscribe:    "|/usr/local/mailman/mail/mailman subscribe mailman"
        mailman-unsubscribe:  "|/usr/local/mailman/mail/mailman unsubscribe mailman"
    
        Hit enter to notify mailman owner...
    
        

    Be sure to add the listed aliases to /etc/mail/aliases or wherever the aliases file lives on your system, run Sendmail's newaliases command to regenerate the aliases database (/etc/mail/aliases.db in this example), and restart Sendmail so it picks up the new aliases. After you create the list, subscribe yourself to the newly-created list.

  18. Finally, create the site-wide password using the mmsitepass script:
        # su - mailman
        $ bin/mmsitepass newpass
        Password changed.
        

    Of course, replace newpass with the password you chose.

  19. That's it! I recommend creating a test list, as explained in the README file in the Mailman distribution, to verify that the installation is working as intended. You might also want to customize Mailman further -- I leave this as an exercise for the reader. ;-)

$Id: mailman.html,v 1.5 2003/01/25 05:21:58 kwall Exp kwall $