# Anywhere you see lists.foo.org below, replace that with the FQDN
# of your list server. If it has multiple names, use whatever name you
# want list readers to see.
# Before building it, because configure will look for them, create a mailman
# group, user, and directory:
su
getent group | grep "^mailman:" > /dev/null 2>&1 || groupadd mailman
id mailman > /dev/null 2>&1 || useradd -g mailman mailman
mkdir -p /usr/local/mailman
chown mailman:mailman /usr/local/mailman
chmod a+rx,g+ws /usr/local/mailman
exit
# Get the tarball
cd
test -f installed/mailman-2.1.39.tgz && mv installed/mailman-2.1.39.tgz .
test ! -f mailman-2.1.39.tgz &&
wget https://ftpmirror.gnu.org/mailman/mailman-2.1.39.tgz
# Verify tarball w/ md5sum:
# (md5sum is from launchpad)
echo "6edf92c119da01ed42665530dfaa2c92 mailman-2.1.39.tgz" | md5sum -c
# Verify tarball w/ sha256sum:
# (this came from my md5sum and gpg-verified tarball)
echo "7b8e9222364abdfd25cb2053c422319aac7b620c287dd979703e0399d72f43\
90 mailman-2.1.39.tgz" | sha256sum -c
# Mailman 2.0.x used to have a default prefix of /home/mailman, if you're
# upgrading a 2.0.x installation and want to keep everything there, add
# --prefix=/home/mailman to the configure line below and replace any
# occurance of /usr/local/mailman below with /home/mailman.
# With --with-mail-gid, specify the gid used by Sendmail (or Postfix,
# or whatever you use). If you use the sample mailer definition for
# Sendmail below, this will be daemon.
#
# With --with-cgi-gid, specify the gid used by Apache, which for 1.x
# is usually 'nobody' and for 2.x is usually 'daemon' (source) or 'apache'
# (Slackware package). Something like this may get the answer for you:
# egrep "^Group " /etc/httpd/httpd.conf
# egrep "^Group " /usr/local/apache2/conf/httpd.conf
# If your existing (if an upgrade) rc.mailman will not run without an error,
# and you recently upgraded Python, you may need to open up
# /usr/local/mailman/bin/mailmanctl
# and set PYTHON= to the full path to your Python program. If you
# have multiple versions installed, you may need to use /usr/bin/python2.7
# or whatever you have installed.
# If you are upgrading Mailman, it is highly suggested that you shut down
# at least Mailman, if not also shut down or redirect your MTA (Sendmail,
# Postfix, whatever) and Apache. This is how I shut down Mailman on my
# system.
/etc/rc.d/rc.mailman stop
# If this is an upgrade and your current Mailman is in /usr/local/mailman,
# run something like this to back up everything. Better to run this
# while Mailman is not running so files don't change while tar is running.
# (log files might not show an in-process message, etc.)
( mkdir -p -m 0700 ~/backup/mail/mailman
tar cjvf ~/backup/mail/mailman-$(date +%Y%m%d).tar.bz2 /usr/local/mailman )
# Install Mailman's files to /usr/local/mailman or wherever you specified
# with --prefix above (if you did). In an upgrade, you install the files
# over the old ones, which is why you should back up /usr/local/mailman
# (or whatever it is) first.
# If you are upgrading, 'make install' also does a 'make update'.
make install
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# If this tells you any permissions are incorrect, fix them, then re-run it.
# If you pass "-f" to it, it should fix them for you.
( cd /usr/local/mailman ; bin/check_perms )
# If this is an upgrade, restart Mailman like this:
# (or use 'start' if you stopped it above)
# /etc/rc.d/rc.mailman restart
# Create a mm-handler.new in . from ./contrib/mm-handler:
cat contrib/mm-handler | sed -e 's%/usr/local/bin/perl%/usr/bin/perl%' \
-e 's%/usr/lib/sendmail%/usr/sbin/sendmail%' \
-e 's%/home/mailman%/usr/local/mailman%' > ./mm-handler.new
# If this is an upgrade, see if your installed Sendmail mm-handler is
# different from the one in ./contrib:
test -f /etc/mail/mm-handler &&
diff -u ./mm-handler.new /etc/mail/mm-handler | less
# If this is not an upgrade, or if you want to update yours, install
# the new one. Replace the 'daemon' group below with whatever you
# configured --with-mail-gid as:
# egrep "^S\[\"MAIL_GROUP\"]=" config.status | cut -d'"' -f4
# ...and if you used --with-username, replace the mailman user below
# with that.
test -f /etc/mail/mm-handler &&
( mv -f /etc/mail/mm-handler /etc/mail/mm-handler.old
chown root:root /etc/mail/mm-handler.old
chmod 600 /etc/mail/mm-handler.old )
test -s ./mm-handler.new &&
( cp mm-handler.new /etc/mail/mm-handler
chown mailman:daemon /etc/mail/mm-handler
chmod 750 /etc/mail/mm-handler )
# Mailman 2.0.x used to use /usr/local/mailman/mail/wrapper for it's
# Sendmail mailer. If you use Sendmail's smrsh (Sendmail restricted shell),
# you can get rid of any old symlinks you have in your smrsh directory
# linking to those old names/paths. Create a symlink for mm-handler so
# smrsh will run it:
test -d /var/adm/sm.bin &&
( cd /var/adm/sm.bin ; ln -sf /etc/mail/mm-handler )
# Make sure Sendmail will accept mail for lists.foo.org Add it to
# VIRTUSER_DOMAIN or add it to the VIRTUSER_DOMAIN_FILE if you use that.
# Make sure it's NOT in class {w} (/etc/mail/local-host-names).
## Add this mailer definition to your sendmail.mc Replace each [tab]
## below with an actual tab (and don't leave the #s at the beginning of each
## line).
# MAILER_DEFINITIONS
# Mmailman,[tab]P=/etc/mail/mm-handler, F=rDFMhlqSu, U=mailman:daemon,
# [tab][tab]S=EnvFromL, R=EnvToL/HdrToL,
# [tab][tab]A=mm-handler $h $u
## Install your updated sendmail.mc:
# make install-cf
## Add a line like this to /etc/mail/mailertable:
# lists.foo.org mailman:lists.foo.org
## Add these virtuals to /etc/mail/virtusertable and add aliases for
## abuse, mailman-owner, and root if necessary.
# abuse@lists.foo.org abuse
# MAILER-DAEMON@lists.foo.org mailman-owner
# mailman@lists.foo.org mailman-owner
# mailman-owner@lists.foo.org mailman-owner
# postmaster@lists.foo.org mailman-owner
# webmaster@lists.foo.org mailman-owner
# root@lists.foo.org root
## Create all of the hashes, run newaliases, etc. then HUP Sendmail:
# newaliases
# makemap hash mailertable < mailertable
# makemap hash virtusertable < virtusertable
# kill -HUP `head -1 /var/run/sendmail.pid`
## If you use something like lists.foo.org, this is an example Apache
## VirtualHost entry for httpd.conf, extra/httpd-vhosts.conf, or whatever
## yours uses. After adding this, run 'apachectl configtest' and then
## 'apachectl restart'. If installed under /usr/local/apache2, you may need
## to run apachectl with the full path: /usr/local/apache2/bin/apachectl
#
# DocumentRoot /usr/local/apache2/htdocs/lists.foo.org
# ServerName lists.foo.org
# ServerAlias lists
# ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
# Alias /pipermail/ /usr/local/mailman/archives/public/
#
# Order Allow,Deny
# Allow from all
#
#
# Options FollowSymLinks
#
# ErrorLog logs/lists.foo.org-error_log
# CustomLog logs/lists.foo.org-access_log combined
#
## Here's another from a more recent Slackware packaged Apache:
## (/srv/httpd is just a symlink to /var/www)
#
# DocumentRoot "/srv/httpd/htdocs/lists.foo.org"
# ServerName lists.foo.org
# ServerAlias lists
# ScriptAlias /mailman/ "/usr/local/mailman/cgi-bin/"
# Alias /pipermail/ /usr/local/mailman/archives/public/
#
# Require all granted
#
#
# Require all granted
#
#
# #Options ExecCGI
# Order Allow,Deny
# Allow from all
#
#
# Options FollowSymLinks
#
# ErrorLog "/var/log/httpd/lists.foo.org-error_log"
# CustomLog "/var/log/httpd/lists.foo.org-access_log" combined
#
# Put the mailman/python/gnu images somewhere:
cd /usr/local/mailman/icons
cp PythonPowered.png gnu-head-tiny.jpg mailman.jpg mm-icon.png \
/usr/local/apache2/htdocs/lists.foo.org/images/
chown root:daemon /usr/local/apache2/htdocs/lists.foo.org/images/*
chmod 440 /usr/local/apache2/htdocs/lists.foo.org/images/*
# Tell mailman where to find the images:
echo >> /usr/local/mailman/Mailman/mm_cfg.py
echo "IMAGE_LOGOS = '/images/'" >> /usr/local/mailman/Mailman/mm_cfg.py
# Create site-wide mailing list (for password reminders):
cd /usr/local/mailman
bin/newlist mailman
bin/config_list -i data/sitelist.cfg mailman
# Make sure all is well with the site-wide list, subscribe yourself:
lynx http://lists.foo.org/mailman/admin/mailman
## Set up /usr/local/mailman/cron/crontab.in as a crontab for user mailman
## This has changed since mailman 2.0.x, so make sure you remove old
## crontab entries that aren't in crontab.in:
# crontab -e -u mailman
# :r/usr/local/mailman/cron/crontab.in
#
# :wq
# Create an rc file to start up mailman on boot-up
# If this is an upgrade, see if yours is different:
# ( cd /usr/local/mailman ; diff -u scripts/mailman /etc/rc.d/rc.mailman )
cd /usr/local/mailman
cp scripts/mailman /etc/rc.d/rc.mailman
chmod 700 /etc/rc.d/rc.mailman
## And add something like this to /etc/rc.d/rc.local to get it to run on
## boot-up:
# if [ -x /etc/rc.d/rc.mailman ]; then
# /etc/rc.d/rc.mailman start
# fi
# Read through /usr/local/mailman/Mailman/Defaults.py and override anything
# necessary by setting it in /usr/local/mailman/Mailman/mm_cfg.py
# Create your site password:
cd /usr/local/mailman
bin/mmsitepass
# If this is a new installation, and you're ready for it, fire up Mailman:
# /etc/rc.d/rc.mailman start
# Create your first list:
# (or at the commandline run '/usr/local/mailman/bin/newlist -h')
lynx http://lists.foo.org/mailman/create
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/mailman-*.tgz
mv mailman-2.1.39.tgz installed/
# If you ever want to uninstall Mailman, this should do it:
cd
su
test -x /etc/rc.d/rc.mailman && /etc/rc.d/rc.mailman stop
test -d /usr/local/mailman && rm -r /usr/local/mailman
rm -f /etc/mail/mm-handler /etc/rc.d/rc.mailman /var/adm/sm.bin/mm-handler
exit
find ~/src -maxdepth 1 -type d -name "mailman-*" -exec rm -r {} \;
rm -f ~/installed/mailman-*.tar.*