分类: 系统运维
2014-01-02 14:42:05
Mailman的安装和配置
Kenny Song
用户要求安装邮件列表管理mailman,先把过程记录如下:
添加用户和组
#groupadd mailman
#/usr/sbin/useradd -c''GNU Mailman'' -s /no/shell -d /no/home -g mailman mailman
设置安装目录:
#mkdir –p /usr/local/mailman-2.1.17
#chgrp mailman /usr/local/mailman-2.1.17
#chmod a+rx,g+ws /usr/local/mailman-2.1.17
编译和安装
#./configure --prefix=/usr/local/mailman-2.1.17 --with-cgi-gid=mailman --with-username=mailman --with-groupname=mailman --with-mail-gid=mailman
#make &make install
#cd /usr/local
#ln –s mailman-2.1.17 mailman
配置和启动:
#cd /usr/local/mailman/Mailman
#vim mm_cfg.py
添加下面几行
###########################
POSTFIX_STYLE_VIRTUAL_DOMAINS = [mydomain.com']
add_virtualhost('mydomain.com','mydomain.com')
DEFAULT_EMAIL_HOST = 'mydomian.com'
DEFAULT_URL_HOST = 'mydomain.com'
DEFAULT_SERVER_LANGUAGE = 'zh_CN'
############################
#cd /usr/local/mailman/bin
#./check_perms –f
Warning: Private archive directory is other-executable (o+x).
This could allow other users on your system to read private archives.
If you're on a shared multiuser system, you should consult the
installation manual on how to fix this.
No problems found
启动服务:
#./mailmanctl start
设置apache:
在httpd.conf中,添加如下文件:
################################
ScriptAlias /mailman/ /usr/local/mailman/cgi-bin/
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Alias /pipermail/ /usr/local/mailman/archives/public/
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
#################################
修改httpd.conf的User和Group为mailman。
重启apache,
通过http://ip/mailman/admin管理列表。
设置sendmail
修改/etc/mail/sendmail.cf
修改DefaultUser为mailman
##############################
O DefaultUser=mailman
##############################
在末尾添加:
##############################
O AliasFile=/etc/mail/aliases, /etc/mail/mailman-aliases
##############################
设置cron job建立aliase文件。
###############################
#!/bin/bash
/usr/local/mailman/bin/genaliases | sed -n '5,$p' > /etc/mail/mailman-aliases
/usr/bin/newaliases
################################
设置每5分钟执行一次:
#cront –e
################################
*/5 * * * * /cronjob/newaliase_mailman.sh > /dev/null 2>&1
################################
重启sendmail即可。