斑竹网络专注为中小企业客户提供以管理服务为核心的IT全方位服务 https://www.sysadm.cn
分类: 系统运维
2013-12-16 10:04:56
一、 安装netqmail (netqmail-1.05.tar.gz)
# rpm -e --nodeps sendmail 卸载已有的sendmail程序
# tar -zxvf netqmail-1.05.tar.gz
# cd netqmail-1.05
# ./collate.sh #生成netqmail-1.05目录及相关的补丁包
#执行了上述的命令以后,应该会有7行的提示,要注意看提示信息;
# mkdir /var/qmail
# cd netqmail-1.05
cp INSTALL.ids ../ #将用于建立用户的文件拷贝出来,并修改它
# groupadd vchkpw –g 89 #建立vpopmail 用户
# useradd vpopmail –u 89 –g vchkpw
# cd ..
# vi INSTALL.ids #删除属于其它系统的脚本,然后将它的属性修改为可执行的
# chmod +x INSTALL.idx
# ./INSTALL.ids #执行以后,检查一下用户有没有建立成功,如果没有执行成功,
则需要重新执行一次
# cd netqmail-1.05
# vi qmail-smtpd.c # 将straynewline函数中的 451修改成 553 当你的服务器收到无
效格式的邮件时,会发送:"I am not going to accept that message at the moment,you can try again later",对方服务器收到后,几秒钟后又会发送同样的邮件给你,造成多次的重复。
# 改为553后,你的服务器将直接发送:"I am not going to accept that message,don't try sending it again.",告诉对方的服务器不要再发这封无效的信件。
RedHat/Fedora用户可能需要为TLS补丁链接一个include文件
# ln -s /usr/kerberos/include/com_err.h /usr/include/
# make setup check
# ./config-fast #其中 是主机名
#设置管理员的邮箱地址。
#发往root/postmaster/mailer-daemon地址的邮件将会由定义的管理员邮箱接收。
# cd /var/qmail/alias
# echo "postmaster@smartpay.com.cn" > .qmail-postmaster
# echo "postmaster@smartpay.com.cn" > .qmail-mailer-daemon
# echo "postmaster@smartpay.com.cn" > .qmail-root
# chmod 644 /var/qmail/alias/.qmail*
#开启SPF设置
# echo ./Maildir/ >/var/qmail/control/defaultdelivery
# echo 3 > /var/qmail/control/spfbehavior
添加qmail的帮助手册
# echo MANPATH /var/qmail/man >> /etc/man.config
为qmail服务建立监控目录和日志文件:
# mkdir -p /var/qmail/supervise/qmail-send/log
# mkdir -p /var/qmail/supervise/qmail-smtpd/log
# mkdir -p /var/qmail/supervise/qmail-pop3d/log
# mkdir -p /var/qmail/supervise/qmail-pop3ds/log
# cd /root/software
# tar -zxvf toaster-scripts-0.7.tar.gz (这个从地址下载)
# cp toaster-scripts-0.7/send.run /var/qmail/supervise/qmail-send/run
# cp toaster-scripts-0.7/send.log.run /var/qmail/supervise/qmail-send/log/run
# cp toaster-scripts-0.7/smtpd.log.run /var/qmail/supervise/qqmail-smtpd/log/run mail-smtpd/log/run
# cp toaster-scripts-0.7/smtpd.run /var/qmail/supervise/qmail-smtpd/run
# cp toaster-scripts-0.7/pop3d.run /var/qmail/supervise/qmail-pop3d/run
# cp toaster-scripts-0.7/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run
# cp toaster-scripts-0.7/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run
# cp toaster-scripts-0.7/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run
以下的指令我建立了一个可执行文件来执行,文件内容如下:
echo 20 > /var/qmail/control/concurrencyincoming>>log.txt
chmod 644 /var/qmail/control/concurrencyincoming >>log.txt
chmod 755 /var/qmail/supervise/qmail-send/run >>log.txt
chmod 755 /var/qmail/supervise/qmail-send/log/run >>log.txt
chmod 755 /var/qmail/supervise/qmail-smtpd/run >> log.txt
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run >> log.txt
chmod 755 /var/qmail/supervise/qmail-pop3d/run >> log.txt
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run >> log.txt
chmod 755 /var/qmail/supervise/qmail-pop3ds/run >> log.txt
chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run >> log.txt
mkdir -p /var/log/qmail/smtpd >> log.txt
mkdir -p /var/log/qmail/pop3d >> log.txt
mkdir -p /var/log/qmail/pop3ds >> log.txt
chown -R qmaill /var/log/qmail >> log.txt
# chmod +x chk_mod.sh
# ./chk_mod.sh
启动脚本
# cd /root/software/
# cp toaster-scripts-0.7/rc /var/qmail/rc
# chmod 755 /var/qmail/rc
# cp toaster-scripts-0.7/qmailctl /var/qmail/bin/
# chmod 755 /var/qmail/bin/qmailctl
# ln -s /var/qmail/bin/qmailctl /usr/bin
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
rm -rf /usr/lib/sendmail 稍后再执行,等QMAIL安装成功才删除
# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
# 启动,停止,重启,查看队列等
qmailctl start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help