rhas3.0 + qmail + mysql + smtp + vpopmail + igenus + qmailadmin
一、安裝說明。
為了方便安裝我在安裝Redhat3.0時選了apache、PHP、mysql,注意mysql-devel開發包一定要裝上,
二、安裝UCspi-tcp-0.88
1.這是由於redhat3.0(包括redhat 9.0)的glibc的版本有問題,必須有下列軟件及補丁才能編譯
http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
http://qmail.te8.com/rpms/glibc-2.3.1/ucspi-tcp-0.88.a_record.patch
http://qmail.te8.com/rpms/glibc-2.3.1/ucspi-tcp-0.88.errno.patch
http://qmail.te8.com/rpms/glibc-2.3.1/ucspi-tcp-0.88.nobase.patch
2.安裝ucspi-tcp-0.88
#tar zxvf ucspi-tcp-0.88.tar.gz
#cd ucspi-tcp-0.88
#patch -p1 < ../ucspi-tcp-0.88.a_record.patch
#patch -p1 < ../ucspi-tcp-0.88.errno.patch
#patch -p1 < ../ucspi-tcp-0.88.nobase.patch
#make
#make setup check
三、安裝qmail
1.需要的軟件及補丁
http://cr.yp.to/software/qmail-1.03.tar.gz
http://www.ckdhr.com/ckd/qmail-103.patch
http://www.qmail.org/qmailqueue-patch
http://www.shupp.org/patches/qmail-maildir++.patch
http://qmail.te8.com/rpms/glibc-2.3.1/qmail-1.03.errno.patch
http://qmail.te8.com/rpms/glibc-2.3.1/qmail-1.03.qmail_local.patch
http://members.elysium.pl/brush/qmail-smtp-auth/dist/qmail-smtpd-auth-0.31.tar.gz
2.建立目錄
# mkdir /var/qmail
# mkdir /var/qmail/alias
3.建組及用戶
# groupadd nofiles
# groupadd qmail
# useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent
# useradd qmaild -g nofiles -d /var/qmail -s /nonexistent
# useradd qmaill -g nofiles -d /var/qmail -s /nonexistent
# useradd qmailp -g nofiles -d /var/qmail -s /nonexistent
# useradd qmailq -g qmail -d /var/qmail -s /nonexistent
# useradd qmailr -g qmail -d /var/qmail -s /nonexistent
# useradd qmails -g qmail -d /var/qmail -s /nonexistent
4.打補丁及編繹安裝qmail
#tar zxvf qmail-1.03.tar.gz
#tar zxvf qmail-smtpd-auth-0.31.tar.gz
#cp qmail-smtpd-auth-0.31/base64.* qmail-1.03
#patch -d qmail-1.03 < qmail-smtpd-auth-0.31/auth.patch
#cd qmail-1.03
#patch -p1 < ../qmail-103.patch
#patch -p1 < ../qmailqueue-patch
#patch -p1 < ../qmail-maildir++.patch
#patch -p1 < ../qmail-1.03.errno.patch
#patch -p1 < ../qmail-1.03.qmail_local.patch
#vi qmail-smtpd.c 將函數straynewline中的451改為553
#make setup check
#./config-fast domain.com
5.添加別名用戶
# touch /var/qmail/alias/.qmail-root
# touch /var/qmail/alias/.qmail-postmaster
# touch /var/qmail/alias/.qmail-mailer-daemon
6.如果存在postfix和sendmail,將它們停用。
#/etc/rc.d/init.d/sendmail stop
#cp /var/qmail/bin/sendmail /usr/sbin/qmail.sendmail
#rm -f /etc/alternatives/mta
#ln -s /usr/sbin/qmail.sendmail /etc/alternatives/mta
#rm -f /usr/lib/sendmail
#rm -f /usr/sbin/sendmail
#ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
#ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
#chmod 777 /usr/sbin/sendmail
四、安裝vpopmail
1.下載vpopmail
http://www.inter7.com/vpopmail/vpopmail-5.2.1.tar.gz
2.建立目錄
#mkdir /home/vpopmail
#mkdir /home/vpopmail/etc
3.添加用戶和組
#groupadd vchkpw
#useradd -g vchkpw vpopmail
4.添加mysql的vpopmail用戶,用於操作vpopmail數據庫
#mysqladmin -u root passWord **** 設置mysql的root密碼。
#mysql -u root -p
mysql>create database vpopmail;
mysql>grant all on vpopmail.* to vpopmail@localhost identified by "密碼";
5.編譯安裝vpopmail
#tar zxvf vpopmail-5.2.1.tar.gz
#cd vpopmail-5.2.1
#vi vmysql.h
=========================== vmysql.h ==============================
#define MYSQL_UPDATE_SERVER "localhost"
#define MYSQL_UPDATE_USER "vpopmail"
#define MYSQL_UPDATE_PASSWD "****" (改成你設置的密碼)
#define MYSQL_READ_SERVER "localhost"
#define MYSQL_READ_USER "vpopmail"
#define MYSQL_READ_PASSWD "****" (改成你設置的密碼)
==========================================================
6.創建tcp.smtp
# vi /home/vpopmail/etc/tcp.smtp
==================== tcp.smtp ============================
127.0.0.1:allow,RELAYCLIENT=""
:allow
==========================================================
#cd /home/vpopmail/etc
#tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp
7.進行編譯:
# ./configure
--prefix=/home/vpopmail
--enable-mysql=y
--enable-incdir=/usr/include/mysql
--enable-libdir=/usr/lib/mysql
--enable-default-domain=domain.com
--enable-passwd=n
--enable-defaultquota=52428800s (10485760:10MB,20971520:20MB,52428800s:50MB)
--enable-tcprules-prog=/usr/local/bin/tcprules
--enable-tcpserver-file=/home/vpopmail/etc/tcp.smtp
--enable-vpopuser=vpopmail
--enable-vpopgroup=vchkpw
--enable-ip-alias-domains=n
# make
# make install-strip
8.創建虛擬域
# cd /home/vpopmail/bin
# /home/vpopmail/bin/vadddomain 域名 密碼
# /home/vpopmail/bin/vadduser 用戶名 密碼 (用戶名要帶域名,如
[email protected])
刪除創建域的命令是:./vdeldomain 域名
五、設置smtp-auth
1.修改vchkpw的屬性
#chmod 4755 vchkpw
#chown root.root vchkpw
2.下載安裝cmd5checkpw
wget http://members.elysium.pl/brush/cmd5checkpw/dist/cmd5checkpw-0.22.tar.gz
#tar zxvf cmd5checkpw-0.22.tar.gz
#cd cmd5checkpw-0.22
#make
#make install
六、生成qmail的啟動腳本
#cp /var/qmail/boot/home /var/qmail/rc
# vi /var/qmail/rc //對rc文件進行修改,以決定投送方式:
================= rc =========================
#!/bin/sh
# Using splogger to send the log through syslog.
# Using dot-forward to support sendmail-style ~/.forward files.
# Using qmail-local to deliver messages to ~/Mailbox by default.
exec env - PATH="/var/qmail/bin:$PATH" qmail-start ./Maildir/ splogger qmail &
================== rc ==========================
#vi /var/qmail/smtp
=================== smtp ========================
#!/bin/sh
QMAILDUID=qmaild
NOFILESGID=nofiles
/usr/local/bin/tcpserver -H -R -l 0 -t 1 -v -p -x /home/vpopmail/etc/tcp.smtp.cdb -u $QMAILDUID -g $NOFILESGID 0 smtp /var/qmail/bin/qmail-smtpd domain.com /home/vpopmail/bin/vchkpw /bin/true /bin/cmd5checkpw /bin/true 2>&1 /var/qmail/bin/splogger smtpd 3 &
=================== smtp ============================
#vi /var/qmail/pop3 //編輯pop3服務的啟動腳本
====================== pop3 =========================
#!/bin/sh
/usr/local/bin/tcpserver -H -R 0 pop3 /var/qmail/bin/qmail-popup domain.com /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir &
======================= pop3==============================
#chmod 755 /var/qmail/rc
#chmod 755 /var/qmail/smtp
#chmod 755 /var/qmail/pop3
七、運行qmail並測試
#/var/qmail/rc
#/var/qmail/smtp
# /var/qmail/pop3
#ps aux grep "qmail"
查看POP3和SMTP是否工作
# telnet 192.168.0.1 110
# telnet 192.168.0.1 25
注意在Outlook中設置郵件帳號時,用戶名後要加上域名,如
[email protected]。如果qmail出現問題,可查看mysql中的vpopmail數據庫,/var/log下的my
#chmod 755 /var/qmail/smtp
#chmod 755 /var/qmail/pop3
七、運行qmail並測試
#/var/qmail/rc
#/var/qmail/smtp
# /var/qmail/pop3
#ps aux grep "qmail"
查看POP3和SMTP是否工作
# telnet 192.168.0.1 110
# telnet 192.168.0.1 25
注意在Outlook中設置郵件帳號時,用戶名後要加上域名,如
[email protected]。如果qmail出現問題,可查看mysql中的vpopmail數據庫,/var/log下的my