Qmail邮件服务器安装过程
时间:2007-03-27 09:49:00
软件列表:
checkpassword-0.90(pop3验证用户程序)
cmd5checkpw-0.22.tar.gz
ucspi-tcp-0.88(tcpserver等服务程序)
qmail-smtpd-auth-0.30.tar.gz(smtp补丁程序)
qmail-1.03.tar.gz(Qmail基本系统包)
vpopmail-5.2.1.tar.gz(虚拟域用户pop3支持)
ezmlm-0.53.tar.gz(邮件列表管理软件)
autorespond.tar.gz(自动回复程序)
qmailadmin-1.0.6.tar.gz(虚拟域web方式管理)
以上所有软件可从以网址下载:
http://www.qmail.org
http://www.inter7.com/qmail
安装前准备工作:
新建qmail 安装目录
# mkdir /var/qmail:
添加qmail所必须的用户和组
# groupadd nofiles
# useradd -g nofiles -d /var/qmail/alias alias
# useradd -g nofiles -d /var/qmail qmaild
# useradd -g nofiles -d /var/qmail qmaill
# useradd -g nofiles -d /var/qmail qmailp
# groupadd qmail
# useradd -g qmail -d /var/qmail qmailq
# useradd -g qmail -d /var/qmail qmailr
# useradd -g qmail -d /var/qmail qmails
安裝qmail基本系统:
安装checkpassword-0.90(/bin)
# cd /usr/local/src
# tar xzvf checkpassword-0.90.tar.gz
# cd checkpassword-0.90
# patch -p1 <../patch/checkpassword-0.90.errno.patch
# make
# make setup check
安裝cmd5checkpw-0.22.tar.gz
# tar zxvf cmd5checkpw-0.22.tar.gz
# mkdir /usr/man
# mkdir /usr/man/man8
# cd cmd5checkpw-0.22
# make
# make install
安装ucspi-tcp-0.88(/usr/local/bin)
# cd /usr/local/src
# tar xzvf ucspi-tcp-0.88.tar.gz
# cd ucspi-tcp-0.88
# patch -p1 < ../patch/ucspi-tcp-0.88.a_record.patch
# patch -p1 < ../patch/ucspi-tcp-0.88.errno.patch
# patch -p1 < ../patch/ucspi-tcp-0.88.nodefaultrbl.patch
# make
# make setup check
安装Qmail(qmail-1.03.tar.gz)
# tar xzvf qmail-1.03.tar.gz
SMTP补丁及其它补丁:
# tar zxvf qmail-smtpd-auth-0.30.tar.gz
# cd qmail-smtpd-auth-0.30
# cp base64.c base64.h README.auth ../qmail-1.03/
# patch -d ../qmail-1.03 < auth.patch
# cd qmail-1.03
# patch -p1 < ../patch/qmail-103.patch
# patch -p1 < ../patch/qmailqueue-patch
# patch -p1 < ../patch/qmail-maildir++.patch
# patch -p1 < ../patch/qmail-1.03.errno.patch
# patch -p1 < ../patch/qmail-1.03.qmail_local.patch
# vi qmail-smtpd.c //将函数straynewline中的451改为553
//将451改为553是为避免当其它服务器给你发来无效格式的邮件时,你的服务器陷入循环应答。
# make setup check
#./config-fast test.com
建立系统别名:
# cd ~alias;touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
# echo test.com > /var/qmail/control/helohost \\主机名(解决新浪拒收邮件问题)
# chmod 644 ~alias/.qmail*
# echo "127.0.0.1:allow,RELAYCLIENT=""" > /etc/tcp.smtp
# chmod 4755 /bin/checkpassword
# sed 's/Mailbox/Maildir\//' /var/qmail/boot/home >/var/qmail/rc
(修改/var/qmail/rc把./Mailbox 改成./Maildir/ 使用Maildir的pop3收信方式)
# chmod 755 /var/qmail/rc
停止sendmail 服务:
# /etc/rc.d/init.d/sendmail stop
# rpm –e –nodeps sendmail
Qmail Web管理系统:
安装虚拟域
# groupadd vchkpw
# useradd -g vchkpw vpopmail
# mkdir ~vpopmail/etc
# echo "127.0.0.:allow,RELAYCLIENT=\"\"" > ~vpopmail/etc/tcp.smtp
# echo ":allow" >/etc/tcp.smtp
# /usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
# cd /usr/local/src
# tar xzvf vpopmail-5.2.1.tar.gz
# cd vpopmail-5.2.1
#./configure --enable-roaming-users=y --enable-default-domain=test.com --enable-passwd=n
# make
# make install-strip
# crontab –e
40 * * * * /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
# cd /home/vpopmail/bin
#./vadddomain test.com eitop
#./vadduser test@test.com test
# chmod 6755 /home/vpopmail/bin/vchkpw
安装邮件列表
# tar xzvf ezmlm-0.53-idx-0.41.tar.gz
# cd ezmlm-0.53-idx-0.41
# make
# make man
# make setup
安装自动回复程序
# tar zxvf autorespond.tar.gz
# make(gcc -Wall -o autorespond autorespond.c)
# make install(cp autorespond /usr/local/bin/autorespond)
安装虚拟域web方式管理
# tar xzvf qmailadmin-1.0.6.tar.gz
# cd qmailadmin-1.0.6
#./configure --enable-htmldir=/www/web1 --enable-cgibindir=/usr/local/apache2/cgi-bin
# make
# make install-strip
建Qmail启动文件
# vi /etc/rc.d/init.d/qmail
#! /bin/sh
case "$1" in
start)
echo -n "start qmail:"
/var/qmail/rc &
echo "."
echo -n "start smtp service:"
/usr/local/bin/tcpserver -H -R -l 0 -t 1 -c 100 -x /etc/tcp.smtp.cdb -u 512 -g 505 0 smtp /var/qmail/bin/qmail-smtpd test.com /home/vpopmail/bin/vchkpw /bin/true /bin/md5checkpw /bin/true &
echo "."
echo -n "start pop3 service:"
/usr/local/bin/tcpserver -l test.com -U -c 100 -H -R 0 pop3 /var/qmail/bin/qmail-popup test.com /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir &
echo "."
;;
stop)
echo -n "stop qmail:"
echo "."
;;
*)
exit 1
;;
esac
exit 0
# chmod 755 /etc/rc.d/init.d/qmail
# /etc/rc.d/init.d/qmail start
启动文件中的用户组为vpopmail用户组
如果不能启动qmail,执行touch /etc/dnsrewrite
测试:
SMTP认证测试
su - qmaild -c "/var/qmail/bin/qmail-popup localhost /home/vpopmail/bin/vchkpw pwd"
su - qmaild -c "/var/qmail/bin/qmail-popup localhost /bin/checkpassword pwd"
user test
pass test
输入用户密码后出现回应,若出现test用户的home目录,则SMTP成功;若提示:"-ERR authorization failed",则SMTP失败
Web管理测试:
打开http://localhost/cgi-bin/qmailadmin,输入域名test.com和密码,进入管理界面,新建邮箱用户和邮件列表。
邮件测试:
主要测试内网用户互发邮件,内多与外网互发邮件。