Thu, 10 Aug 2006

Mailman using Postfix on Debian

    The following is a description on how to set up the list manager Mailman
    on a Debian system that uses Postfix-MySQL-Apache for virtual websites and
    email.  It uses a Python script that makes it unnecessary to make entries
    into /etc/aliases.  But for this Python script to work, you must be
    willing to prefix the FQDN portion of your listname with "lists"...

        correct:  mylist@lists.virtdomain1.org

        incorrect:  mylist@virtdomain1.org

    While this may seem a sacrifice, it can easily be overcome later by simply
    creating an alias in your MySQL table from mylist@virtdomain1.org to
    mylist@list.virtdomain1.org.  This is far easier than adding in all of the
    Mailman aliases that would normally have to be added to /etc/aliases if
    you were not using the Python script.

    1.  Make sure your virtual websites and virtual email setups are all
    working before doing anything with Mailman.

    2.  Install Mailman via apt-get using normal defaults for the base website
    that runs on the server.

    3.  Edit /etc/mailman/mm_cfg.py
        
        add:
            VIRTUAL_HOSTS.clear()
            add_virtualhost('virtdomain1.org','lists.virtdomain1.org')
            add_virtualhost('virtdomain2.org','lists.virtdomain2.org')

        change DEFAULT_EMAIL_HOST to include the prefix 'lists' to the FQDN
        as in:
            DEFAULT_EMAIL_HOST = 'lists.rustybear.com'

        change IMAGE_LOGOS from whatever default is to:
            IMAGE_LOGOS = /'icons'/ 

    4.  copy Mailman images over to default /icons/ directory for Apache

            cp /usr/share/images/mailman/*  /usr/share/apache/icons/.

    5.  Edit /etc/apache/httpd.conf

        for any  you have configured, add in:
            ScriptAlias /mailman/  /usr/lib/cgi-bin/mailman/
        in the  section.

        and in an appropriate place (not within a VirtualHost directive) in
        httpd.conf add in:

            
                Options +FollowSymLinks
            

        you'll need the above to get pipermail (archives) working.

    6.  Get this python script:

        If you are installing via Debian apt-get this section is probably
        mostly done for you, but check anyway.

        http://www.gurulabs.com/files/postfix-to-mailman-2.1.py

        and drop it in /etc/mailman/ and rename it without the version number

            mv postfix-to-mailman-x.xx.py  postfix-to-mailman.py

        edit it by changing the entry for MailmanHome
             MailmanHome = "/var/lib/mailman"; 
        
        the Mailman home directory is where the lists are kept.

        Then cd to /usr/lib/mailman/bin and symlink back to
        postfix-to-mailman.py

            cd /usr/lib/mailman/bin
            ln -s /etc/mailman/postfix-to-mailman.py

    7.  Next go to /etc/mailman/postfix-to-mailman.py and read all of the
        comments/instructions.

        Note that in the recommended changes to /etc/postfix/master.cf, that
        you must set the uid:gid as list:list, not as mailman:mailman.
        This is probably specific to Debian only as the deb package has
        Mailman using 'list' as UID/GID where source versions of Mailman
        probably have 'mailman' as a default UID.

        Note also that in the changes to master.cf, you need to change the
        argv argument to point to /etc/mailman/postfix-to-mailman.py.

        This is also a good time to:

            chmod 755 /etc/mailman/postfix-to-mailman.py
            chown root:list /etc/mailman/postfix-to-mailman.py

        The instructions in postfix-to-mailman.py point out how to set up
        /etc/postfix/tranport and mail.cf.  You can do it that way, or more
        simply, just make an entry in your existing transport setup for MySQL.
        In my case I have a table called transport, where normally I put a
        domain name (i.e. xyz.com) and transport type (usually either virtual:
        or local: ).  However, in this case, the entry I make is:

            domain:     lists.virtdomain1.org
            transport:  mailman:

        Alternatively, you could follow the instructions and make the changes
        to main.cf and transport as that works too.  If you do it that way,
        don't forget to execute

            postmap /etc/postfix/transport

        after making changes to transport to regenerate its data.

    8.  Make sure you have a DNS entry in your DNS server for
        lists.virtdomain1.org, or at least a wildcard entry, that resolves to
        virtdomain1.org.

    9.  Restart Apache and Mailman (/etc/init.d/mailman restart).

    10. To create a new list for one of the virtual websites, at the prompt
        execute:

        newlist myNewList@lists.virtdomain1.org

        It will prompt you for a couple things that are obvious.  Make sure
        you include the 'lists' prefix before the FQDN, as having 'lists'
        there is what makes this whole thing work via the python script we put
        in -- /etc/mailman/postfix-to-mailman.py.

        You should get an email regarding the newly created list you
        just made.

        Note also that simply executing 'newlist --help' gives some help too.
        Also, reading the docs at /usr/share/docs/mailman is a good idea too.
        
        You should now be able to see your admin page at:
        http://lists.virtdomain1.org/cgi-bin/mailman/admin/myNewList

    11. Thing should be working and you should be able to subscribe new users
        and send emails to be posted, etc.  Try sending test posts and
        watching /var/log/syslog or wherever you have you email logs set up
        and watching for errors as the test posts go through Postfix.  It's
        best to watch this live using 'tail -f /var/log/syslog'.

    12. Good luck!

Posted at: 21:36 | category: /configure | Comments ()