Qmail系统的安装实例
作者:solaris这是去年我装qmail时所写的文档,应该没有什么问题。
关于qmail的安装
系统平台:
Redhat Linux 7.1
所需软件包:
qmail-1.03.tar.gz
ucspi-tcp-0.88.tar.gz
daemontools-0.76.tar.gz
checkpassword-0.90.tar.gz
vpopmail-5.0.1.tar.gz
ezmlm-0.53.tar.gz
autorespond-2.0.2.tar.gz
qmailadmin-1.0.1.tar.gz
sqwebmail-3.3.1.tar.gz
vqsignup-0.5.tar.gz
安装步骤:
1.安装qmail
i安装前的准备工作
准备安装目录
#mkdir /var/qmail
建立qmail的用户和组
On Solaris and Linux:
# 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
On FreeBSD 2.2:
# pw groupadd nofiles
# pw useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent
# pw useradd qmaild -g nofiles -d /var/qmail -s /nonexistent
# pw useradd qmaill -g nofiles -d /var/qmail -s /nonexistent
# pw useradd qmailp -g nofiles -d /var/qmail -s /nonexistent
# pw groupadd qmail
# pw useradd qmailq -g qmail -d /var/qmail -s /nonexistent
# pw useradd qmailr -g qmail -d /var/qmail -s /nonexistent
# pw useradd qmails -g qmail -d /var/qmail -s /nonexistent
On AIX:
# mkgroup -A nofiles
# mkuser pgrp=nofiles home=/var/qmail/alias shell=/bin/true alias
# mkuser pgrp=nofiles home=/var/qmail shell=/bin/true qmaild
# mkuser pgrp=nofiles home=/var/qmail shell=/bin/true qmaill
# mkuser pgrp=nofiles home=/var/qmail shell=/bin/true qmailp
# mkgroup -A qmail
# mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmailq
# mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmailr
# mkuser pgrp=qmail home=/var/qmail shell=/bin/true qmails
安装:
#cp qmail-1.03.tar.gz /usr/local/src
#tar ?zxvf qmail-1.03.tar.gz
#cd qmail-1.03
#make setup check
#./config (如果主机名不在DNS中,运行#./config-fast hostname
建立邮件别名
#cd /var/qmail/alias
#touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
#chmod 644 .qmail*
#echo ‘root’ > .qmail*
建立qmail启动文件并设置用户的Maildir
#cp /var/qmail/boot/home /var/qmail/rc
#chmod 755 /var/qmail/rc
#vi /var/qmail/rc
将./Mailbox改为./Maildir/
建立本用户的Maildir
/var/qmail/bin/maildirmake
echo ./Maildir/ >~/.qmail
chmod 700 ~/Maildir
为以后新建用户设置Maildir
/var/qmail/bin/maildirmake /etc/skel/Maildir
echo ./Maildir/>~/.qmail
安装ucspi-tcp
#cp ucspi-tcp-0.88.tar.gz /usr/local/src
#tar ?zxvf ucspi-tcp-0.88.tar.gz
#cd /usr/local/src/ucspi-tcp-0.88
#make
#make setup check
安装daemontools
#mkdir ?p /package
#chmod 1755 /package
#cp daemontools-0.76.tar.gz /package
#tar ?zxvf daemontools-0.76.tar.gz
#cd daemontools-0.76
#/package/install
安装checkpassword
checkpassword 主要用于对/etc/passwd中的用户开放mail,如果采用虚拟域名则只需装vpopmail即可。
安装vpopmail
#groupadd vchkpw
#useradd ?g vchkpw vpopmail
#mkdir ~vpopmail/etc
#echo “:allow” > ~vpopmail/etc/tcp.smtp
#./configure ?enable-roaming-users=y ?enable-default-domain=domain.com ?enable-passwd=n (详细配置参考INSTALL文件或打./configure ?help)
#make
#make install-strip
#crontab ?e
40 * * * * /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
#cd /home/vpopmail/bin
用vadddomain,vaddusers来添加虚拟域和虚拟用户。
删除所有sendmail文件和进程(尤其是进程,一定要删除,否则将占据端口)
建立系统别名
#cd /var/qmail/alias
#touch .qmail-postmaster .qmail-daemon .qmail-root
#chmod 644 .qmail*
#echo ‘root’ > .qmail*
建立Maildir
#cp /var/qmail/boot/home /var/qmail/rc
#chmod 755 /var/qmail/rc
#vi /var/qmail/rc
修改最后一行,将./Mailbox改为./Maildir/
#/var/qmail/bin/maildirmake /etc/skel/Maildir
#echo ./Maildir/ >~/.qmail
建立qmailctl脚本
#vi /var/qmail/bin/qmailctl
#!/bin/sh
# For Red Hat chkconfig
# chkconfig: - 80 30
# description: the qmail MTA
PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
case "$1" in
start)
echo "Starting qmail"
if svok /service/qmail-send ; then
svc -u /service/qmail-send
else
echo qmail-send supervise not running
fi
if svok /service/qmail-smtpd ; then
svc -u /service/qmail-smtpd
else
echo qmail-smtpd supervise not running
fi
if [ -d /var/lock/subsys ]; then
touch /var/lock/subsys/qmail
fi
fi
if svok /service/qmail-pop3d ; then
svc -u /service/qmail-pop3d
else
echo qmail-pop3d supervise not running
fi
;;
stop)
echo "Stopping qmail..."
echo " qmail-smtpd"
svc -d /service/qmail-smtpd
echo " qmail-send"
svc -d /service/qmail-send
echo " qmail-pop3d"
svc -d /service/qmail-pop3d
if [ -f /var/lock/subsys/qmail ]; then
rm /var/lock/subsys/qmail
fi
;;
stat)
svstat /service/qmail-send
svstat /service/qmail-send/log
svstat /service/qmail-smtpd
svstat /service/qmail-smtpd/log
svstat /service/qmail-pop3d
svstat /service/qmail-pop3d/log
qmail-qstat
;;
doqueue|alrm|flush)
echo "Flushing timeout table and sending ALRM signal to qmail-send."
/var/qmail/bin/qmail-tcpok
svc -a /service/qmail-send
;;
queue)
qmail-qstat
qmail-qread
;;
reload|hup)
echo "Sending HUP signal to qmail-send."
svc -h /service/qmail-send
;;
pause)
echo "Pausing qmail-send"
svc -p /service/qmail-send
echo "Pausing qmail-smtpd"
svc -p /service/qmail-smtpd
echo "Pausing qmail-pop3d"
svc -