本向导将向您介绍如何在Ubuntu下使用apache网络服务器系统以及exim电子邮件服务器系统安装配置Mailman电子邮件收发软件。此向导只针对有经验的linux用户以及系统管理员。
假如这是您第一次接触Mailman,本章的内容或许可以对您起到抛砖引玉的作用。Mailman是一个专门用于管理电邮讨论群以及newsletter的开源软件。有许多开源的mailinglist(包括Ubuntu mailing list)使用Mailman作为创建mailing list的工具。Mailman功能强大,易于安装及维护。
您必须保证您熟悉如何执行linux命令,如何编辑文件,如何在linux系统里开始以及终止服务。同时您必须是Ubuntu系统的管理员,已经连接上网,并已经预设好/etc/apt/sources.list.
安装
Mailman为管理员以及普通用户提供了网页界面。Mailman采用外设的电邮服务器来发送以及接受邮件,他能很好的在以下服务器下工作
Postfix
Exim
Sendmail
Qmail
在本章我们将为您介绍如何安装mailman,如何apache网络服务器以及Exim或Postfix电邮服务器。如果您需要为其他的电邮服务器安装mailman,请参考后面的特别需要指南,您将在文章的末尾处找到。
Apache2
Apache2 已经在库中。请安装一下包文件:apache2
Exim4
Exim4 已经在库中。请安装以下包文件:exim4
一旦exim4被安装,设置文件将会存储在/etc/exim4/。在ubuntu中默认的情况下, exim4 设置文件被一分为二。你能通过改变以下这几个文件中的变量改变这些显示情况:
/etc/exim4/update-exim4.conf:
dc_use_split_config='true'
我们将在下一节讨论Exim4更多的设置方法^_^,如果你在安装时遇到了任何你不能解决的问题,请适当的咨询mailing list以获得更多的帮助。^_^
后缀
安装以下包文件: postfix,请选择“Internet Site(网站)”和default options默认选项。
Mailman
Mailman 已经在库中。请安装以下包文件mailman。
它从/var/lib/mailman中复制了安装文件。它会安装CGI脚本在/usr/lib/cgi-bin/mailman 文件夹。
Mailman 创建了一个名为“list”的Linux用户。它还创建了一个名为list的Linux用户组。Mailman的处理进程将会被这个用户所掌握。
配置
如果你在这一节中成功地完成了Mailman,Apache和Mail server的安装。现在,你就需要配置它们。当你完成这一节后,你的Mailman将会征程工作!^_^
Exim4 集成
一旦Exim4被安装,你就可以通过以下命令去运行它:
# /etc/init.d/exim4 start
为了是Mailman使用Exim4开始工作,你需要配置Exim4.提前说一下,在默认情况,Exim4使用不同类型的多重配置文件。详细信息,请参见Exim 网站。想要运行Mailman,我们需要添加一个新的配置文件到以下的配置配型。
Main
Transport
Router
Exim通过排列所有的小型配置文件来创建3个主配置文件。所以,配置文件的顺序是非常非常重要的!
Main
所有属于main类型的配置文件被储存在/etc/exim4/conf.d/main/文件夹。你能添加以下的内容在一个新的文件。你可以把它命名为 04_exim4-config_mailman::
# start
# Home dir for your Mailman installation -- aka Mailman's prefix
# directory.
# By default this is set to "/usr/local/mailman"
# On a Red Hat/Fedora system using the RPM use "/var/mailman"
# On Debian using the deb package use "/var/lib/mailman"
# This is normally the same as ~mailman
MM_HOME=/var/lib/mailman
#
# User and group for Mailman, should match your --with-mail-gid
# switch to Mailman's configure script. Value is normally "mailman"
MM_UID=list
MM_GID=list
#
# Domains that your lists are in - colon separated list
# you may wish to add these into local_domains as well
domainlist mm_domains=bluestar.co.in
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# These values are derived from the ones above and should not need
# editing unless you have munged your mailman installation
#
# The path of the Mailman mail wrapper script
MM_WRAP=MM_HOME/mail/mailman
#
# The path of the list config file (used as a required file when
# verifying list addresses)
MM_LISTCHK=MM_HOME/lists/${lc::$local_part}/config.pck
# end
Transport
所有属于transport 类型的配置文件被储存在 /etc/exim4/conf.d/transport/ 文件夹。你能添加以下的内容在一个新的文件。你可以把它命名为 40_exim4-config_mailman::
mailman_transport:
driver = pipe
command = MM_WRAP \
'${if def:local_part_suffix \
{${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1\}\}\} \
{post}}' \
$local_part
current_directory = MM_HOME
home_directory = MM_HOME
user = MM_UID
group = MM_GID
“注意:在以上的配置中,在第5行,我已经删掉了三个(\}\}\}) 来保证推这个文档的兼容性。请在你保存文件之前添加它们。“
Router
所有属于router 类型的配置文件被储存在 /etc/exim4/conf.d/router/文件夹。你能添加以下的内容在一个新的文件。你可以把它命名为 101_exim4-config_mailman::
mailman_router:
driver = accept
require_files = MM_HOME/lists/$local_part/config.pck
local_part_suffix_optional
local_part_suffix = -bounces : -bounces+* : \
-confirm+* : -join : -leave : \
-owner : -request : -admin
transport = mailman_transport
注意:Main和transport的配置文件可以使用任何顺序。但是router的配置文件必须使用同样的顺序。特定的文件必须在200_exim4-config_primary文件之前出现。这两个配置文件包含了同样的信息类型。第一个文件持有优先权。更多的细节,请参见exim网站,或者参考本页中的信息。
Postfix integration
For this integration, we will associates the domain lists.example.com with the mailing lists. As a consequence, the domain will be reserved for the mailing-list traffic. You can nevertheless have a website to this domain (usually, the domain lists.example.com is used by the mailing list system and for the mailman web interface).
Edit the main.cf to add the following lines:
relay_domains = lists.example.com
transport_maps = hash:/etc/postfix/transport
mailman_destination_recipient_limit = 1
In master.cf check that you ever have the following transport:
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
It calls the postfix-to-mailman.py script when a mail is delivered to a list.Associate the domain lists.example.com to the mailman transport with the transport map. Edit the file /etc/postfix/transport:
lists.example.com mailman:
Do not forget to launch postmap -v /etc/postfix/transport after this modification.That's all ! It is very easy and very efficient.
Mailman
Once mailman is installed, you should create the default mailing list. Run the following command:
# newlist mailman
Enter the email of the person running the list: bhuvaneswaran at NOSPAM gmail.com
Initial mailman password:
To finish creating your mailing list, you must edit your /etc/aliases (or
equivalent) file by adding the following lines, and possibly running the
`newaliases' program:
## mailman mailing list
mailman: "|/var/lib/mailman/mail/mailman post mailman"
mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman"
mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman"
mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman"
mailman-join: "|/var/lib/mailman/mail/mailman join mailman"
mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman"
mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman"
mailman-request: "|/var/lib/mailman/mail/mailman request mailman"
mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
Hit enter to notify mailman owner...
#
Once mailman is installed and the default mailing list created, you can run it using the following command:
# /etc/init.d/mailman start
We have configured exim and postfix to recognize all emails from mailman. So, it's not mandatory to make any new entries in /etc/aliases.If you have made any changes to the configuration files, please ensure that you restart those services, before continuing to next section.
useradd mailman |
groupadd mailman |
chgrp mailman . chmod a+rx,g+ws . |
|
|
|
cp /usr/local/mailman/icons/*.{jpg,png} /path/to/apache/icons |
|
|