518 lines
18 KiB
HTML
518 lines
18 KiB
HTML
<!--startcut ==============================================-->
|
|
<!-- *** BEGIN HTML header *** -->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML><HEAD>
|
|
<title>Setting Up a Web-based Archive for a Mailing List LG #72</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
|
|
ALINK="#FF0000">
|
|
<!-- *** END HTML header *** -->
|
|
|
|
<CENTER>
|
|
<A HREF="http://www.linuxgazette.com/">
|
|
<IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
|
|
WIDTH="600" HEIGHT="124" border="0"></A>
|
|
<BR>
|
|
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="teo.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue72/teo2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage72.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
<P>
|
|
</CENTER>
|
|
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4 ALIGN="center">
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<H1><font color="maroon">Setting Up a Web-based Archive for a Mailing List</font></H1>
|
|
<H4>By <a href="mailto:%6C%61%77%72%65%6E%63%65%74%65%6F%40%6C%79%63%6F%73%2E%63%6F%6D">Lawrence Teo</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
|
|
<!-- END header -->
|
|
|
|
|
|
|
|
|
|
<H2>1. Introduction</H2>
|
|
|
|
<P>
|
|
In this article, I'll describe how to set up a web-based archive for
|
|
a mailing list. This article picks up from where I left off in my previous
|
|
article, <A HREF="teo.html">"A Quick and Easy Way to Set Up a Mailing List"</A>,
|
|
also in this issue
|
|
of Linux Gazette. If you haven't already done so, I highly recommend that
|
|
you read that article first before reading this one. A lot of the context and
|
|
content in here are derived from the methods described in that article.
|
|
</P>
|
|
|
|
<H3>1.1 The mailing list setup</H3>
|
|
|
|
<P>
|
|
First, I'll briefly describe the mailing list setup that we'll be using in
|
|
this article. If you have read the previous article, this setup will be
|
|
familiar to you.
|
|
</P>
|
|
|
|
<P>
|
|
Let's say that we have a mailing list called theproject@mybox.example.com,
|
|
running on a Linux system called mybox.example.com. The e-mail addresses
|
|
subscribed to this list are linus@mybox.example.com, alan@example.net, and
|
|
esr@example.org. We set this up using our Mail Transfer Agent's aliases file
|
|
(usually /etc/mail/aliases or /etc/aliases, depending on your distribution).
|
|
Our mailing list has been set up like this in the aliases file:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
theproject:
|
|
linus,
|
|
alan@example.net,
|
|
esr@example.org
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
So when e-mails are sent to theproject@mybox.example.com, those e-mails will
|
|
be automatically propagated to linus@mybox.example.com, alan@example.net,
|
|
and esr@example.org.
|
|
</P>
|
|
|
|
<H2>2. Setting up the web-based archive</H2>
|
|
|
|
<P>
|
|
Before we get started with the instructions for setting up the web-based
|
|
archive, I'll first explain what we plan to achieve. What we want to do is
|
|
allow your workgroup members to access a website that will host your mailing
|
|
list archive. For example, you can host your mailing list archive on
|
|
http://mybox.example.com/theproject/ and make it accessible to all your
|
|
workgroup members.
|
|
</P>
|
|
|
|
<P>
|
|
Having a web-based archive makes it easier and more
|
|
convenient to check out what has been discussed. Also, it can act as a central
|
|
location to store documents and other attachments. You can also use it as
|
|
a backup in the unfortunate event that you lose your e-mails (which I hope
|
|
will never happen!).
|
|
</P>
|
|
|
|
<P>
|
|
If you want to set up a web-based archive for your mailing list, you'll need:
|
|
</P>
|
|
|
|
<P>
|
|
<UL>
|
|
<LI> <B>The Apache webserver.</B> Of course, you can use some other
|
|
webserver. However, Apache is the most common webserver installed by
|
|
default on almost all Linux distributions (to my knowledge), and it's
|
|
also the one that I'm most familiar with. In this article, I'll use
|
|
Apache 1.3.20 as the example.
|
|
<LI> <B>Hypermail.</B> Hypermail is a nifty program that you can use
|
|
to generate web-based mail archives from a UNIX mailbox file. You can
|
|
grab it from
|
|
<A HREF="http://www.hypermail.org/">http://www.hypermail.org/</A>.
|
|
I'll use hypermail 2.1.2 for the purposes of this article.
|
|
<LI> <B>cron.</B> cron is a program that you can use to run tasks
|
|
at scheduled times. It should be installed by default in all
|
|
Linux distributions (I'll be shocked if I find a distribution that
|
|
doesn't include cron!). In this article, we'll use cron to update
|
|
our web-based archive periodically.
|
|
</UL>
|
|
</P>
|
|
|
|
<P>
|
|
You'll first need to check if the webserver is running. Again, you can
|
|
use the netstat command to do this:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
lteo@mybox:~$ <B>netstat -a | grep www</B>
|
|
tcp 0 0 *:www *:* LISTEN
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
If the system responds with that line, it is likely that your webserver is
|
|
already running. If it is not, you can start it by issuing the command
|
|
"/etc/init.d/apache start" on Debian, the same or "/etc/rc.d/init.d/httpd
|
|
start" on Red Hat, etc. In Slackware, issue the command "/etc/rc.d/rc.httpd
|
|
start".
|
|
</P>
|
|
|
|
<H3>2.1 Installing hypermail</H3>
|
|
|
|
<P>
|
|
After you've downloaded hypermail, proceed to install it using the instructions
|
|
in its README file. The installation steps should be pretty standard. If
|
|
you're in a hurry, the following commands should work for you (they're
|
|
meant for hypermail 2.1.2; substitute the version number for the hypermail
|
|
version you downloaded):
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
root@mybox:~# <B>tar zxf hypermail-2.1.2.tgz</B>
|
|
root@mybox:~# <B>cd hypermail-2.1.2</B>
|
|
root@mybox:~/hypermail-2.1.2# <B>./configure</B>
|
|
root@mybox:~/hypermail-2.1.2# <B>make</B>
|
|
root@mybox:~/hypermail-2.1.2# <B>make install</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<H3>2.2 Creating a dummy account</H3>
|
|
|
|
<P>
|
|
The next thing you need to do is to set up a dummy user account on your
|
|
system. We will register this account on the mailing list, and use it
|
|
exclusively for collecting all mails sent to the mailing list. We will then
|
|
generate the mailing list archive using this dummy user account's mailbox.
|
|
</P>
|
|
|
|
<P>
|
|
Let's call our dummy account "projarc". You can create it in the same way
|
|
you create a normal user account on your Linux distribution. I personally use
|
|
the adduser command on my Debian GNU/Linux system:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
root@mybox:~# <B>adduser</B>
|
|
Enter a username to add: <B>projarc</B>
|
|
Adding user projarc...
|
|
Adding new group projarc (1004).
|
|
Adding new user projarc (1004) with group projarc.
|
|
Creating home directory /home/projarc.
|
|
Copying files from /etc/skel
|
|
Enter new UNIX password: <B><password></B>
|
|
Retype new UNIX password: <B><password></B>
|
|
passwd: password updated successfully
|
|
Changing the user information for projarc
|
|
Enter the new value, or press return for the default
|
|
Full Name []: <B>Dummy user</B>
|
|
Room Number []:
|
|
Work Phone []:
|
|
Home Phone []:
|
|
Other []:
|
|
Is the information correct? [y/n] <B>y</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
You will need to add this user to your the aliases file (/etc/mail/aliases
|
|
or /etc/aliases) to get it registered as a member of the mailing list. To do
|
|
this, just edit the file and add the username to the list. The section that
|
|
describes your mailing list members in the aliases file should look like
|
|
this:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
# The Project mailing list
|
|
theproject:
|
|
projarc,
|
|
linus,
|
|
alan@example.net,
|
|
esr@example.org
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
Remember to run that command to inform your MTA about the changes after
|
|
you've done this.
|
|
</P>
|
|
|
|
<P>
|
|
We will be using projarc's public webspace to host our mailing list archive.
|
|
To do that, create a public_html directory in the projarc's home directory:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
lteo@mybox:~$ <B>su - projarc</B>
|
|
Password: <B><password></B>
|
|
projarc@mybox:~$ <B>mkdir public_html</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
Note that the user's public webspace may be represented by another name instead
|
|
of public_html. It depends on your webserver setup. You also need to ensure
|
|
that your webserver allows users to host public webspaces in this manner.
|
|
I'll explain how to enable this in the next section.
|
|
</P>
|
|
|
|
<H3>2.3 Setting up Apache</H3>
|
|
|
|
<P>
|
|
The next step is to set up Apache so that it allows users on the machine to
|
|
have their own public web directories. The Apache configuration file you
|
|
need to edit is /etc/apache/httpd.conf. Again, this may differ depending
|
|
on your distribution. If it's not there, issue the command "locate httpd.conf"
|
|
or "find / -name httpd.conf" to find it. Once you've found it, open it up
|
|
with your text editor and make sure that the following lines are uncommented
|
|
(meaning they don't have the # symbol in front of them):
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
<IfModule mod_userdir.c>
|
|
UserDir public_html
|
|
</IfModule>
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
It is likely that your UserDir value is not public_html, and may be something
|
|
else like www. You can use whatever directory name you wish to represent
|
|
the user's webspace.
|
|
</P>
|
|
|
|
<P>
|
|
Now if you want your workgroup members to access your archive using an
|
|
address such as http://mybox.example.com/theproject/ you'll need to set up a
|
|
symbolic link from your Apache's root webspace to point to projarc's webspace.
|
|
To find out what your Apache's root webspace is, check out the DocumentRoot
|
|
value in /etc/apache/httpd.conf:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
root@mybox:~# <B>grep ^DocumentRoot /etc/apache/httpd.conf</B>
|
|
DocumentRoot /var/www
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
In the above example, Apache's root webspace is at /var/www. To create a
|
|
symbolic link to point to projarc's public webspace, issue the following
|
|
commands:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
root@mybox:~# <B>cd /var/www</B>
|
|
root@mybox:/var/www# <B>ln -s /home/projarc/public_html theproject</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<H3>2.4 Testing hypermail</H3>
|
|
|
|
<P>
|
|
When a user receives e-mails, the e-mails will be stored in a file called
|
|
/var/mail/username. So in the case of projarc, the file will be called
|
|
/var/mail/projarc (Note: in some distributions, this would be
|
|
/var/spool/mail/projarc).
|
|
</P>
|
|
|
|
<P>
|
|
We can use hypermail to read that mail file to generate the
|
|
web-based archive. However, when the projarc account is newly created, that
|
|
file won't exist yet. So you'll need to send an e-mail to
|
|
theproject@mybox.example.com first just to get that file created.
|
|
</P>
|
|
|
|
<P>
|
|
After sending out that test mail, run the following command as projarc:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
projarc@mybox:~$ <B>hypermail -m /var/mail/projarc -l "The Project" -d /home/projarc/public_html</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
Now open up http://mybox.example.com/theproject/ in your web browser and
|
|
you should see your mailing list archive there. It should look something like
|
|
this:
|
|
</P>
|
|
|
|
<CENTER>
|
|
<TABLE BORDER="1" CELLSPACING="1" WIDTH="70%">
|
|
<TR><TD>
|
|
<H1 ALIGN="center">The Project<BR>By Thread</H1>
|
|
|
|
<FONT COLOR="blue"><STRONG><U>Most recent messages</STRONG></U></FONT><BR>
|
|
|
|
<STRONG>1 messages sorted by:</STRONG>
|
|
<FONT COLOR="blue">
|
|
<U>[ author ]</U>
|
|
<U>[ date ]</U>
|
|
<U>[ subject ]</U>
|
|
<U>[ attachment ]</U>
|
|
</FONT>
|
|
<HR NOSHADE><P>
|
|
<STRONG>Starting:</STRONG> <EM>Sat Oct 20 2001 - 01:45:23 EDT</EM><BR>
|
|
<STRONG>Ending:</STRONG> <EM>Sat Oct 20 2001 - 01:45:23 EDT</EM><BR>
|
|
<UL>
|
|
<LI><FONT COLOR="blue"><U><STRONG>This is the first message</STRONG></U></FONT> <EM>Lawrence Teo <SMALL>(Sat Oct 20 2001 - 01:45:23 EDT)</SMALL></EM>
|
|
</UL>
|
|
<P>
|
|
<STRONG>Last message date:</STRONG></A> <EM>Sat Oct 20 2001 - 01:45:23 EDT</EM><BR>
|
|
<STRONG>Archived on:</STRONG> <em>Sun Oct 21 2001 - 01:50:56 EDT</EM><p>
|
|
<HR NOSHADE>
|
|
|
|
<STRONG>1 messages sorted by:</STRONG>
|
|
<FONT COLOR="blue">
|
|
<U>[ author ]</U>
|
|
<U>[ date ]</U>
|
|
<U>[ subject ]</U>
|
|
<U>[ attachment ]</U>
|
|
</FONT>
|
|
</TD></TR>
|
|
</TABLE>
|
|
</CENTER>
|
|
|
|
<P>
|
|
It would be more convenient to use a hypermail configuration file to run
|
|
hypermail instead of typing in all those command-line parameters all the time.
|
|
To do this, create a file called /home/projarc/projarc-hmrc and fill it with
|
|
the following lines:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
mbox = /var/mail/projarc
|
|
label = The Project
|
|
dir = /home/projarc/public_html
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
You can now generate the mailing archive by running the following command:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
projarc@mybox:~$ <B>hypermail -c /home/projarc/projarc-hmrc</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<H3>2.5 Setting up cron</H3>
|
|
|
|
<P>
|
|
Now, we would definitely want our mailing list archive to be automatically
|
|
updated whenever somebody sends mail to the mailing list. We will use cron
|
|
to do this. It won't be updated in real time, but we can set cron to run
|
|
hypermail every 5 minutes, which should be frequent enough for a simple
|
|
mailing list. Of course, you can always use a shorter interval such as
|
|
2 minutes; it's entirely up to you. Just remember that the shorter the interval,
|
|
the more load the machine will have to handle. That may not be good if you
|
|
have mail files that are really big with a lot of attachments, and you're
|
|
hosting several mailing lists on a slow machine.
|
|
</P>
|
|
|
|
<P>
|
|
So, let's set up cron. Issue the following command to edit your cron table:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
projarc@mybox:~$ <B>crontab -e</B>
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
You should now be in an editor with your crontab file open. If you want
|
|
hypermail to run every 5 minutes, enter the following lines:
|
|
</P>
|
|
|
|
<P>
|
|
<PRE>
|
|
# Update The Project mailing list archive every 5 minutes
|
|
*/5 * * * * /usr/bin/hypermail -c /home/projarc/projarc-hmrc
|
|
</PRE>
|
|
</P>
|
|
|
|
<P>
|
|
When you're done, just save and exit. To test it, just wait for five minutes
|
|
and refresh the http://mybox.example.com/theproject/ web page on your
|
|
browser. You should see the updated "Archived on" timestamp after hypermail
|
|
runs.
|
|
</P>
|
|
|
|
<H3>2.6 Summary</H3>
|
|
|
|
<P>
|
|
Here's a summary of the steps we used to set up our web-based mailing list
|
|
archive:
|
|
</P>
|
|
|
|
<P>
|
|
<OL>
|
|
<LI> Make sure that your Apache webserver is up and running. You
|
|
can use the command "netstat -a | grep www" to check this.
|
|
<LI> Install hypermail on your system.
|
|
<LI> Create a dummy account to host your mailing list archive, e.g.
|
|
projarc.
|
|
<LI> Add the dummy account's username to the aliases file (/etc/aliases
|
|
or /etc/mail/aliases). Run the "newaliases" (for sendmail) or
|
|
"postalias /etc/aliases" (for Postfix) command to inform the MTA about
|
|
the changes. You don't need to run any command for exim.
|
|
<LI> Make the public webspace directory for the projarc user, e.g.
|
|
"mkdir public_html"
|
|
<LI> Set up Apache to allow public webspaces for users in the
|
|
/etc/apache/httpd.conf file.
|
|
<LI> Set up a symbolic link to point to projarc's webspace, e.g.
|
|
"ln -s /home/projarc/public_html theproject"
|
|
<LI> Test hypermail by running a command such as 'hypermail -m
|
|
/var/mail/projarc -l "The Project" -d /home/projarc/public_html'. Then
|
|
check "http://mybox.example.com/theproject/" to see if your mailing
|
|
list archive is there.
|
|
<LI> Set up cron to run hypermail every 5 minutes (or at any interval
|
|
you wish).
|
|
</OL>
|
|
</P>
|
|
|
|
<P>
|
|
I hope that you'll find the web-based mailing list archive to be as useful as
|
|
I have. If you have any comments or suggestions, please feel free to drop me
|
|
some e-mail.
|
|
</P>
|
|
|
|
|
|
|
|
<!-- *** BEGIN bio *** -->
|
|
<SPACER TYPE="vertical" SIZE="30">
|
|
<P>
|
|
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Lawrence Teo</H4>
|
|
<EM>Lawrence Teo is a Ph.D. student at the University of North Carolina at
|
|
Charlotte. He researches on intrusion detection
|
|
and critical infrastructure protection technologies with his
|
|
research unit, the Laboratory of Information Integration, Security, and
|
|
Privacy (LIISP). Lawrence has previously worked as a contract software
|
|
engineer at Lycos, Singapore and as a research assistant at DSTC in Melbourne,
|
|
Australia. He holds an Honors Degree in Bachelor of Computing from Monash
|
|
University in Melbourne, Australia. You can send him e-mail at
|
|
<A HREF="mailto:%6C%61%77%72%65%6E%63%65%74%65%6F%40%6C%79%63%6F%73%2E%63%6F%6D">lawrenceteo<SPAM>@lycos.com</A>.</EM>
|
|
|
|
|
|
<!-- *** END bio *** -->
|
|
|
|
<!-- *** BEGIN copyright *** -->
|
|
<P> <hr> <!-- P -->
|
|
<H5 ALIGN=center>
|
|
|
|
Copyright © 2001, Lawrence Teo.<BR>
|
|
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
|
|
Published in Issue 72 of <i>Linux Gazette</i>, November 2001</H5>
|
|
<!-- *** END copyright *** -->
|
|
|
|
<!--startcut ==========================================================-->
|
|
<HR><P>
|
|
<CENTER>
|
|
<!-- *** BEGIN navbar *** -->
|
|
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="teo.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue72/teo2.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="lg_backpage72.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
|
|
<!-- *** END navbar *** -->
|
|
</CENTER>
|
|
</BODY></HTML>
|
|
<!--endcut ============================================================-->
|