In this document I shall try and outline the steps I had to use to make Systers Mailman work on Ubuntu 9.10. Let me know if this document helps you out in making it work. I might have missed a few steps, so any feedback will help me in improving this.
IMPORTANT NOTE: Now you can automate all the below tasks using a script here: http://github.com/beachbrake/setupmailman-script
View the README for more information. Kindly report any bugs found to me so I can improve this script.
First let us update aptitude and upgrade our system:
$ sudo aptitude update $ sudo aptitude upgrade
Now install the Python dependencies for Syster's Mailman:
$ sudo aptitude install python-markdown python-psycopg2 python-storm
This will install Markdown, PostgreSQL and Storm modules for Python.
Now let us install Mailman: On installing the mailman,you should select a language from the list.Use 'space bar' to select the language.
$ sudo aptitude install mailman $ sudo /etc/init.d/mailman stop (stop mailman right now itself)
I use the packaged Mailman as this works with Python 2.6 and has no compatibility issues as such. Just a minor fix needs to be done so it can find the correct libraries. I shall describe that later.
This has also installed apache2 and exim4. We do not want exim4 in our case. So we remove it and install postfix:
$ sudo aptitude install postfix
During installation it will ask for some configuration. Choose Internet Site and give the domain name as localhost.localdomain.
The above command should also automatically remove exim4. If it doesn't then you can manually remove it by using:
$ sudo aptitude purge exim4
We should be done with basic dependencies.
Now we shall add the following line in /etc/hosts (do this as root):
127.0.0.1 localhost.localdomain
Save and exit and try to ping localhost.localdomain. It should be working.
Follow the instructions in Step by Step System Installation to setup PostgreSQL.
Add the following lines to /etc/postfix/master.cf:
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
Now restart postfix:
$ sudo /etc/init.d/postfix restart
The mailman install comes with a pre-built apache configuration to make it run with mailman CGI scripts.
$ sudo cp /etc/mailman/apache.conf /etc/apache2/sites-enabled/mailman
Now restart apache:
$ sudo /etc/init.d/apache2 restart
You should now be able to see mailman site at http://localhost/cgi-bin/mailman/listinfo.
Note: Do everything as root in the following steps.
Let us understand the way Mailman is setup on Ubuntu 9.10 when installed with Aptitude. The following directories are the ones to keep in mind:
/etc/mailman/ - This holds all the configuration for mailman. This will be mostly redundant once we are done setting up mailman code. /var/lib/mailman/ - This is where the system refers to for accessing Mailman. Also all the archives are stored here. Strangely, almost everything here is symlinked to other directories./usr/lib/mailman/ - This is where the actual copy of mailman is stored. And this is where we shall be checking out Systers code.
First we copy over the standard mailman templates to /usr/lib/mailman so that we can overwrite it with our syster's templates.
$ mkdir /usr/lib/mailman/templates $ mv /etc/mailman/en /usr/lib/mailman/templates/
Now we need to make sure that /var/lib/mailman/templates/ points to the new location of templates.
$ mv /var/lib/mailman/templates /var/lib/mailman/templates.old $ ln -s /usr/lib/mailman/templates /var/lib/mailman/templates
Finally, do the following to checkout the code:
$ cd /usr/lib/mailman $ pwd (to make sure you are in /usr/lib/mailman) $ bzr checkout lp:systers .
This will place all the Systers code and rename overwritten files with a .moved suffix.
Now add the following to /usr/lib/mailman/Mailman/mm_cfg.py just after from Defaults import * and before any other code in that file :
#-------------------------------------------------------------------------------
# Beachbrake specific settings
import sys
# Add extra path for python modules (Ubuntu 9.04+ only)
sys.path.append("/usr/lib/python2.6/dist-packages")
sys.path.append("/usr/lib/pymodules/python2.6")
#For testing purposes, delete when moved into production
DEFAULT_EMAIL_HOST = 'localhost.localdomain'
DEFAULT_URL_HOST = 'localhost.localdomain'
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
#-------------------------------------------------------------------------------
Also comment out the line that says MTA = 'Postfix' by adding a # in front of it. We shall use aliases as it keeps things a bit more easier to track (for me at least).
Note that we are adding a value to sys.path so it can search for the libraries in the correct place. The reason that some things break is because apps look for Python libraries in a folder called site-packages. But Ubuntu 9.10 seems to have migrated (no idea why) to a folder called dist-packages. This should allow mailman to access other Python modules.
Now finally let us prepare to run mailman.
Create the required list:
$ newlist systers-admin
The above command will throw some deprecation warnings. Ignore them and go ahead with entering details. Be sure to give the admin email with @localhost.localdomain at the end. When done, it will print out a list of aliases. Copy it and paste to /etc/aliases. After making the change do the following:
$ newaliases
This will regenerate the alias database. Let us fix all the permissions that may have been spoilt during our procedure:
$ /usr/lib/mailman/bin/check_perms -f
Now let us try to run mailman:
/etc/init.d/mailman start
If everything worked out fine so far and mailman starts successfully we are all set!
You might want to make the /usr/lib/mailman writable as normal user so you can edit the files. To do this just change the permissions on it to 777 (do not do this on a production server!).
Let me know if anything goes wrong. Feedback will help in improving this document and eventually allow me to write a script to automate most, if not all, tasks.