CentOS+Qmail安装笔记(3)

#添加qmail的帮助手册
echo MANPATH /var/qmail/man >> /etc/man.config

#为qmail服务建立监控目录和日志文件:
cd /opt/src
cp toaster-scripts-0.9.0/rc /var/qmail/rc
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
cp toaster-scripts-0.9.0/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
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
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
cp /opt/src/toaster-scripts-0.9.0/send.run /var/qmail/supervise/qmail-send/run
cp /opt/src/toaster-scripts-0.9.0/send.log.run /var/qmail/supervise/qmail-send/log/run
cp /opt/src/toaster-scripts-0.9.0/smtpd.run /var/qmail/supervise/qmail-smtpd/run
cp /opt/src/toaster-scripts-0.9.0/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run
cp /opt/src/toaster-scripts-0.9.0/pop3d.run /var/qmail/supervise/qmail-pop3d/run
cp /opt/src/toaster-scripts-0.9.0/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run
cp /opt/src/toaster-scripts-0.9.0/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run
cp /opt/src/toaster-scripts-0.9.0/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
chmod 755 /var/qmail/supervise/qmail-pop3d/run
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run
mkdir -p /var/log/qmail/smtpd
mkdir -p /var/log/qmail/pop3d
mkdir -p /var/log/qmail/pop3ds
chown -R qmaill /var/log/qmail

ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
sleep 5
qmailctl stat

# 检查服务
netstat -an | grep 25
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep

#Now let's compile libdomainkeys, we'll need that later:

cd /opt/src
tar -xzf tar/libdomainkeys-0.68.tar.gz
cd libdomainkeys-0.68
patch -p0 < ../tar/libdomainkeys.diff
make


安装vpopmail:
vpopmail是一个以qmail为基础的虚拟域管理包;其允许在一个IP地址添加多个虚拟域;并且可以不需要使用系统帐号做邮件帐号。
参考:

groupadd -g 89 vchkpw
useradd vpopmail -g vchkpw -d /mail/vpopmail

cd /opt/src
tar -xzf tar/vpopmail-5.4.18.tar.gz
cd vpopmail-5.4.18
patch -p0 < ../tar/vpopmail-5.4.18-cumulative.patch
./configure --enable-auth-module=mysql --enable-passwd=n --enable-tcprules-prog=/usr/local/bin/tcprules --enable-qmaildir=/var/qmail --enable-roaming-users=y --enable-ip-alias-domains=y --enable-clear-passwd=n

make
make install-strip

# 设置smtp规则,关闭open relays
echo '127.:allow,RELAYCLIENT=""' > ~vpopmail/etc/tcp.smtp
cd /mail/vpopmail/etc;tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp

# 设置MySQL信息,第一个vpopmail是帐号,szgwbn为密码,第二个vpopmail是数据库
echo "localhost|3306|vpopmail|szgwbn|vpopmail" > /mail/vpopmail/etc/vpopmail.mysql
chmod 640 /mail/vpopmail/etc/vpopmail.mysql
chown -R vpopmail.vchkpw /mail/vpopmail/etc

新建vpopmail数据库并设置密码
#mysql
mysql>create database vpopmail;
mysql>grant all on vpopmail.* to vpopmail@localhost identified by 'szgwbn';
mysql>exit

#vpopmail启动脚本
cp ../toaster-scripts-0.9.0/vpopmailctl /var/qmail/bin/vpopmailctl
chmod 755 /var/qmail/bin/vpopmailctl
ln -s /var/qmail/bin/vpopmailctl /usr/bin

#为QMAIL打补丁
cd /opt/src/netqmail-1.05/netqmail-1.05
#修改VPOPMAIL路径
vi /opt/src/tar/qmail-toaster-0.7.2.patch
--------------------------------------------
VPOPMAIL_HOME=/mail/vpopmail
--------------------------------------------
#现在打上qmail的补丁:
patch -p0 < /opt/src/tar/qmail-toaster-0.7.2.patch

vi /opt/src/netqmail-1.05/netqmail-1.05/chkuser.c
---------------------------------------------------
#include "/mail/vpopmail/include/vpopmail.h"
#include "/mail/vpopmail/include/vauth.h"
#include "/mail/vpopmail/include/vpopmail_config.h"
---------------------------------------------------
vi /opt/src/netqmail-1.05/netqmail-1.05/Makefile
-------------------------------------------------
VPOPMAIL_HOME=/mail/vpopmail
-------------------------------------------------
make clean
make
qmailctl stop
make setup check
chown -R vpopmail:vchkpw /var/qmail/spam

make cert
make tmprsadh

# 用"crontab -e"在crontab里增加下面这条,每天晚上更新temp keys
01 01 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2>;&1

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygswx.html