CNFUG服务器实现过程( 二 )


#pw groupadd qmail
#pw useradd qmailq -g qmail -d /usr/local/qmail -s /nonexistent
#pw useradd qmailr -g qmail -d /usr/local/qmail -s /nonexistent
#pw useradd qmails -g qmail -d /usr/local/qmail -s /nonexistent
查看建好的用户和组 #pw user show -a
#pw group show -a安装Qmail #tar zxvf qmail-1.03.tar.gz
//对Qmail打补丁
#patch -p0 < qmail-103.patch
#tar zxvf qmail-smtpd-auth-0.30.tar.gz
#cd qmail-smtpd-auth-0.30
#cp base* README.auth ../qmail-1.03
#patch -d ../qmail-1.03 < auth.patch 编辑conf-qmail修改其中的路径为/usr/local/qmail这样qmail就安装到/usr/local/qmail目录下!默认是在/var/qmail目录下!
//执行make检查
#make setup check
./config-fast cnfug.org
//修正SMTP认证信息人员输入和任意更改电子邮件发信人地址的补丁
#cp qmail-smtpd.c qmail-1.03/
#patch < qmail-smtpd.patch.txt
#make qmail-smtpd
#cp qmail-smtpd /usr/local/qmail/bin/qmail-smtpd
【CNFUG服务器实现过程】//建立邮件帐号的别名
#cd /usr/local/qmail/alias
#touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
#chmod 644 /usr/local/qmail/alias/.qmail*
//建立Qmail启动文件
#cp /usr/local/qmail/boot/home /usr/local/qmail/rc
#perl -i -pe "s/Mailbox/Maildir/" /usr/local/qmail/rc

#perl -i -pe "s/sendmail_enable="YES"/sendmail_enable="NONE"/" /etc/rc.conf
#perl -i -pe "s/sendmail_submit_enable="YES"/sendmail_submit_enable="NO"/" /etc/defaults/rc.conf
#perl -i -pe "s/sendmail_outbound_enable="YES"/sendmail_outbound_enable="NO"/" /etc/defaults/rc.conf
#perl -i -pe "s/sendmail_msp_queue_enable="YES"/sendmail_msp_queue_enable="NO"/" /etc/defaults/rc.conf
#mv /usr/lib/sendmail /usr/lib/sendmail.bak(在FreeBSD下该命令不需要)
#mv /usr/sbin/sendmail /usr/sbin/sendmail.bak
#chmod u x /usr/local/qmail/bin/sendmail
#ln -s /usr/local/qmail/bin/sendmail /usr/lib/sendmail(在FreeBSD下该命令不需要)
#ln -s /usr/local/qmail/bin/sendmail /usr/sbin/sendmail
#mkdir -p /etc/qmail
#echo "csh -cf "/usr/local/qmail/rc &"">>/etc/qmail/start
#echo "/etc/qmail/smtp.sh">>/etc/qmail/start
安装ucspi-tcp
tar zxvf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
修改conf-home为/usr/local/qmail(安装到路径/usr/local/qmail/bin/目录下) #vi conf-home
make
make setup check//生成tcp.smtp.cdb
echo "127.0.0.1:allow,RELAYCLIENT=""" > /etc/qmail/tcp.smtp
/usr/local/qmail/bin/tcprules /etc/qmail/tcp.smtp.cdb /etc/qmail/tcp.smtp.tmp < /etc/qmail/tcp.smtp
检查qmaild的uid和gid pw user show qmaild
qmaild:*:3308:3307::0:0:User &:/usr/local/qmail:/nonexistent它的uid是3308,gid是3307 #echo "/usr/local/qmail/bin/tcpserver -H -R -l cnfug.org -t 1 -c 100 -v -p -x /etc/qmail/tcp.smtp.cdb -u 3308 -g 3307 0 smtp /usr/local/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /usr/bin/true /usr/local/qmail/bin/cmd5checkpw /usr/bin/true 2>&1 | /usr/local/qmail/bin/splogger &">/etc/qmail/smtp.sh#chmod 755 /etc/qmail/smtp.sh
cmd5checkpw的安装 make
cp cmd5checkpw /usr/local/qmail/bin/vpopmail的安装
在MySQL中添加vpopmail的用户! /server/mysql/bin/mysql -u root -p
mysql> grant select,insert,update,delete,create,drop on vpopmail.* to vpopmail@localhost identified by "12345678";#mkdir -p /home/vpopmail/etc
#pw groupadd vchkpw -g 89
#pw useradd vpopmail -u 89 -g 89 -d /home/vpopmail -s /nonexistent
#echo "/etc/qmail/start">>/etc/rc.conf
vi vmysql.h 修改一下内容
#define MYSQL_UPDATE_SERVER "localhost" (mysql服务器名)
#define MYSQL_UPDATE_USER "vpopmail" (用户名)
#define MYSQL_UPDATE_PASSWD "12345678" (改成你设置的密码)
#define MYSQL_READ_SERVER "localhost" (mysql服务器名)
#define MYSQL_READ_USER "vpopmail" (用户名)
#define MYSQL_READ_PASSWD "12345678" (改成你设置的密码)
#./configure --prefix=/home/vpopmail --enable-mysql=y --enable-incdir=/server/mysql/include/mysql --enable-libdir=/server/mysql/lib/mysql --enable-libs=/server/mysql/lib/mysql --enable-default-domain=cnfug.org --enable-passwd=n --enable-defaultquota=52428800s --enable-tcprules-prog=/usr/local/qmail/bin/tcprules --enable-tcpserver-file=/etc/qmail/tcp.smtp --enable-vpopuser=vpopmail --enable-vpopgroup=vchkpw --enable-ip-alias-domains=n --enable-roaming-users=y --enable-sqwebmail-pass=y --enable-qmaildir=/usr/local/qmail

推荐阅读