分类: LINUX
2010-09-12 16:42:21
二、安装过程中涉及到的包:
qmail-1.03.tar.gz
qmail-103.patch
qmail-1.03.errno.patch
qmail-smtpd-auth-0.31.tar.gz
vpopmail-5.4.25.tar.gz
ucspi-tcp-0.88.tar.gz
ezmlm-0.53.tar.gz
ezmlm-idx-5.1.2.tar.gz
cmd5checkpw-0.22.tar.gz
autorespond-2.0.2.tar.gz
qmailadmin-1.2.14.tar.gz
lm_sensors-2.10.0-3.1.src.rpm
lm_sensors-debuginfo-2.10.7-4.el5.i386.rpm
三、安装
1.环境变量设置
#PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
#_OS="Linux"
#_LANG="EN"
#_ADDQMAILUSERS="YES"
#_DOMAIN=xxx.com.cn
#_MAILPASSWD=test
#_CGIBIN=/var/www/cgi-bin
#_HTMLPATH=/var/www/html
#_USERCRUISE=n
#_SYSTEMPASS=n
#_VPOPMAIL="YES"
#_EZMLMIN="YES"
#_EZMLM=ch_GB
#_AUTORESPOND="YES"
#_QMAILADMIN="YES"
#_SQL=n
2.检查安装环境:
#uname -s --> RHEL 应该得到:Linux
#whoami --> root,如果不是root,再改为root登陆
#which gcc --> gcc是否安装
#which g++ --> g++是否安装
#which make --> make是否安装
#which perl --> perl是否安装
3.安装qmail
添加相应文件夹\组和用户(可以先用userdel把自己不确认的用户或组先清理一遍)
#mkdir -p /etc/qmail
#mkdir -p /var/uninstall
#userdel alias >/dev/null 2>&1
#userdel qmaild >/dev/null 2>&1
#userdel qmaill >/dev/null 2>&1
#userdel qmailp >/dev/null 2>&1
#userdel qmailq >/dev/null 2>&1
#userdel qmailr >/dev/null 2>&1
#userdel qmails >/dev/null 2>&1
#groupdel nofiles >/dev/null 2>&1
#groupdel qmail >/dev/null 2>&1
#groupadd nofiles
#useradd -g nofiles -d /usr/local/qmail/alias alias
#useradd -g nofiles -d /usr/local/qmail qmaild
#useradd -g nofiles -d /usr/local/qmail qmaill
#useradd -g nofiles -d /usr/local/qmail qmailp
#groupadd qmail
#useradd -g qmail -d /usr/local/qmail qmailq
#useradd -g qmail -d /usr/local/qmail qmailr
#useradd -g qmail -d /usr/local/qmail qmails#mkdir -p /usr/local/qmail
#tar xzf qmail-1.03.tar.gz
#patch -p0 < qmail-103.patch >>/var/uninstall/qmailinstall.log 2>&1
#patch -p0 < qmail-1.03.errno.patch >>/var/uninstall/qmailinstall.log 2>&1
#cd qmail-1.03
#make setup check >>/var/uninstall/qmailinstall.log 2>&1
#./config-fast $_DOMAIN >>/var/uninstall/qmailinstall.log 2>&1
#cd /usr/local/qmail/alias
#touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
#chmod 644 /usr/local/qmail/alias/.qmail*
#cp /usr/local/qmail/boot/home /usr/local/qmail/rc
#perl -i -pe 's/Mailbox/Maildir/' /usr/local/qmail/rc
#killall sendmail >/dev/null 2>&1
#rpm -e fetchmail >/dev/null 2>&1
#rpm -e mutt >/dev/null 2>&1
#rpm -e sendmail >/dev/null 2>&1
#chmod 0 /usr/lib/sendmail >/dev/null 2>&1
#chmod 0 /usr/sbin/sendmail >/dev/null 2>&1
#chmod 0 /usr/lib/sendmail.mx >/dev/null 2>&1
#mv /usr/lib/sendmail /usr/lib/sendmail.bak >/dev/null 2>&1
#mv /usr/sbin/sendmail /usr/sbin/sendmail.bak >/dev/null 2>&1
#ln -s /usr/local/qmail/bin/sendmail /usr/lib/sendmail
#ln -s /usr/local/qmail/bin/sendmail /usr/sbin/sendmail
#echo "csh -cf '/usr/local/qmail/rc &'">>/etc/qmail/start
#echo "/etc/qmail/smtp.sh">>/etc/qmail/start
4.ucspi-tcp-0.88 安装
#tar zxf ucspi-tcp-0.88.tar.gz
#cd ucspi-tcp-0.88
#make >>/var/uninstall/qmailinstall.log 2>&1
#make setup check >>/var/uninstall/qmailinstall.log 2>&1
#QMAILDUID=`/usr/bin/id -u qmaild`
#NOFILESGID=`/usr/bin/id -g qmaild`
#echo "/usr/local/qmail/bin/tcpserver -H -R -l 0 -t 1 -c 100 -v -p -x/etc/qmail/tcp.smtp.cdb -u 507 -g 502 0 smtp /usr/local/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /bin/true /usr/local/qmail/bin/cmd5checkpw /bin/true 2>&1 | /usr/local/qmail/bin/splogger &">/etc/qmail/smtp.sh
#chmod 755 /etc/qmail/smtp.sh
#echo "127.0.0.1:allow,RELAYCLIENT="\"\" > /etc/qmail/tcp.smtp
#echo ":allow">>/etc/qmail/tcp.smtp
#/usr/local/qmail/bin/tcprules /etc/qmail/tcp.smtp.cdb /etc/qmail/tcp.smtp.tmp < /etc/qmail/tcp.smtp
注:smtpd最後需要單獨重新生成.
5.cmd5checkpw install
#tar xzf cmd5checkpw-0.22.tar.gz
#mkdir -p /usr/local/qmail/man/man8
#cd cmd5checkpw-0.22
#make >>/var/uninstall/qmailinstall.log 2>&1
#make install >>/var/uninstall/qmailinstall.log 2>&1
6.VPOPMAIL 安装
#userdel vpopmail
#groupdel vchkpw
#groupadd vchkpw
#useradd -g vchkpw -d /home/vpopmail vpopmail
#echo "/etc/qmail/start">>/etc/rc.d/rc.local
#mkdir -p /home/vpopmail/etc
#echo "127.0.0.1:allow,RELAYCLIENT="\"\" > /home/vpopmail/etc/tcp.smtp
#tar xzf vpopmail-5.4.25.tar.gz
#cd vpopmail-5.4.25
#./configure --enable-clear-passwd=n --enable-passwd=$_SYSTEMPASS --enable-tcprules-prog=/usr/local/qmail/bin/tcprules --enable-ip-alias-domains=n --enable-sqwebmail-pass=y --enable-qmaildir=/usr/local/qmail >>/var/uninstall/qmailinstall.log 2>&1
fi
#make >>/var/uninstall/qmailinstall.log 2>&1
#make install-strip >>/var/uninstall/qmailinstall.log 2>&1
#QMAILDUID=`/usr/bin/id -u qmaild`
#NOFILESGID=`/usr/bin/id -g qmaild`
#echo "/usr/local/qmail/bin/tcpserver -c 100 -v -l $_DOMAIN -U -H -R 0 pop3 /usr/local/qmail/bin/qmail-popup $_DOMAIN /home/vpopmail/bin/vchkpw /usr/local/qmail/bin/qmail-pop3d Maildir 2>&1 | /usr/local/qmail/bin/splogger &">/etc/qmail/pop.sh
#chmod 755 /etc/qmail/pop.sh
#echo "/etc/qmail/pop.sh">>/etc/qmail/start
#chmod 6755 /home/vpopmail/bin/vchkpw
#~vpopmail/bin/vadddomain $_DOMAIN $_MAILPASSWD
6. EZMLMIN安装
#tar zxf ezmlm-0.53.tar.gz
#ezmlm-idx-5.1.2.tar.gz
#mv ezmlm-idx-5.1.2 ezmlm-0.53
#cp -R ezmlm-idx-5.1.2/*/ ezmlm-0.53
#cd ezmlm-0.53
#patch < idx.patch >>/var/uninstall/qmailinstall.log 2>&1
#make >>/var/uninstall/qmailinstall.log 2>&1
#make man >>/var/uninstall/qmailinstall.log 2>&1
#make $_EZMLM >>/var/uninstall/qmailinstall.log 2>&1
#make setup >>/var/uninstall/qmailinstall.log 2>&1
7. AUTORESPOND安装
#tar xzf autorespond-2.0.2.tar.gz
#cd autorespond-2.0.2
#make >>/var/uninstall/qmailinstall.log 2>&1
#make install >>/var/uninstall/qmailinstall.log 2>&1
#mv /usr/include/string.h.bak /usr/include/string.h
8. qmailadmin 安装
#tar xzf qmailadmin-1.2.14.tar.gz
#cd qmailadmin-1.2.14
#./configure --with-htmllibdir=/usr/local/qmail/qmailadmin --enable-qmaildir=/usr/local/qmail --enable-autoresponder-bin=/usr/local/qmail/bin --enable-ezmlmdir=/usr/local/qmail/bin/ezmlm --enable-cgibindir=$_CGIBIN --enable-htmldir=$_HTMLPATH >>/var/uninstall/qmailinstall.log 2>&1
#make >>/var/uninstall/qmailinstall.log 2>&1
#make install-strip >>/var/uninstall/qmailinstall.log 2>&1#chmod 755 /etc/qmail/start
#/etc/qmail/start
#chmod 755 /usr/sbin/qmail
8. 到此大部分安装已经完成,接下来就可以登录 添加一下用户,进行测试了.
四、一些需要调整的东西:
1.重新生成smtpd 验证文件(有关smtp认证)
#tar -zxvf qmail-smtpd-auth-0.31.tar.gz
#cd qmail-smtpd-auth-0.31
#cp README.auth base64.c base64.h ../qmail-1.03/
#patch -d ../qmail-1.03
#patch-d ../qmail-1.03
#patch -d ../qmail-1.03
#patch -p1 < ../qmail-1.03
#patch -d ../qmail-1.03
#cp qmail-smtpd-auth-0.31/auth.patch ./
#cd ../qmail-smtpd-auth-0.31
#patch -d ../qmail-1.03
#cd ../qmail-1.03
#make qmail-smtpd
./load qmail-smtpd rcpthosts.o commands.o timeoutread.
timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o
datetime.a getln.a open.a sig.a case.a env.a stralloc.a
alloc.a substdio.a error.a str.a fs.a auto_qmail.o `cat socket.lib`
#cp qmail-smtpd /usr/local/qmail/bin#chown qmail:qmail /usr/local/qmail/bin/qmail-smtpd --用户组一定要改成qmail,不然smtp认证通过不了.
#chmoe 777 /usr/local/qmail/bin/qmail-smtpd
2. POP3认证(如果权限不对,客户端会不停提醒输入用户名和密码)
#chown vpopmail:vchkpw /home/vpopmail/bin/vchkpw
#chmod 6755 /home/vpopmail/bin/vchkpw (权限一定要对,不然pop3通过不了)
3.因为OS版本问题,有一部分软件要根据情况打补丁,或是软件版本升级,由于软件升级的问题.在vpopmail安装中, default-domain和quota的选项就不用再使用了.
4. 注意:smtp.sh中,-u -g 是vpopmail的用户ID和组ID(**),如果这个配置有问题的话,smtp验证一定是通过不了的.
#如果不知道vpopmail的用户ID和组ID,可以cat /etc/passwd中的用户ID和组ID.
#vi /etc/qmail/smtp.sh
/usr/local/qmail/bin/tcpserver -H -R -l 0 -t 1 -c 100 -v -p -x/etc/qmail/tcp.smtp.cdb -u 507 -g 502 0 smtp /usr/local/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /bin/true /usr/local/qmail/bin/cmd5checkpw /bin/true 2>&1 | /usr/local/qmail/bin/splogger &
5.迁移过程中,新服务器的一些配置一定要记得进行备份.
五、正式开始迁移
因为本身没有涉及到mysql数据库,所以迁移最大的问题还是在用户的权限上.这一点可以通过tar来完成.
1. 在源服务器上:
#/home/vpopmail/domains/
#tar -zcvf xxx.com.cn.tar /home/vpopmail/domains/xxx.com.cn
2.在目的服务器上:
#cd /home/vpopmail/domains/
#tar -zcvf xxx.old.tar /home/vpopmail/domains/xxx.com.cn
#tar -zxvf xxx.com.cn.tar /home/vpopmail/domains/xxx.com.cn
diff 两个服务器上的/usr/local/qmail/contrl 和users中的相关文档,尽量保持一致.
chinaunix网友2010-09-13 15:13:08
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com