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 用户名 密码 (用户名要带域名,如demo@demo.com)
删除创建域的命令是:./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中设置邮件帐号时,用户名后要加上域名,如llzqq@domain.com。如果qmail出现问题,可查看mysql中的vpopmail数据库,/var/log下的mysqld和maillog日志记录。
八、安装并运行igenus
1.下载最新的安装包:igenus_2_20030516_snap.tgz
#tar zxvf igenus_2_20030516_snap.tgz -C /var/www/html
2.建temp文件夹
cd /var/www/html/igenus
mkdir temp
chmod -R 0755 temp
chown -R vpopmail:vchkpw temp
在httpd.conf中设置权限不允许访问temp目录。
deny from all
3.修改httpd.conf
#vi /etc/httpd/conf/httpd.conf
User Apache
Group Apache
修改为:
User vpopmail
Group vchkpw
为了解决APACHE的默认语言问题添加这个:
AddDefaultCharset GB2312
#/etc/rc.d/init.d/httpd restart
4.解决个别邮箱拒收邮件的问题(如新浪网)
修改邮件签名信息
#vi /var/www/html/igenus/config/config_inc.php
$CFG_BASEPATH = "/var/www/html/igenus";
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail';
$CFG_MYSQL_PASS = '******'; 改成你的密码
$CFG_MYSQL_DB = 'vpopmail';
$CFG_TEMP = $CFG_BASEPATh."/temp";
删除其中的
“iGENUS is a free webmail interface, NO fee, FREE download”
修改其中的http://www.igenus.org为http://domain.com
#vi /var/qmail/control/helohost
=============== helohost ====================
domain.com
=============== helohost ====================
#chmod 755 /var/qmail/control/helohost
如果你用的邮件服务器是postfix就这样处理
postconf -e "smtp_helo_name = 我的邮件服务器的域名(A记录)"
如果你用的邮件服务器是sendmail就这样处理
vi /etc/sendmail.cf
Cw我的邮件服务器的域名(A记录)
5.修正邮箱无退信问题
# rm -f /usr/sbin/sendmail
# ln -s /var/qmail/bin/sendmail
如果用qmailadmin管理邮箱则这样处理
进入qmailadmin -->主菜单“邮件账号”-->Set no default catch all account 就OK了。这时网页上面的CatchAll应该显示为Bounced。
6.修改config_inc.php文件
# cd /var/www/html/igenus/config
# vi config_inc.php
=============== config_inc.php ====================
$CFG_BASEPATH = "/var/www/html/igenus";
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail';
$CFG_MYSQL_PASS = '****'; 这里改成你的密码
$CFG_MYSQL_DB = 'vpopmail';
$CFG_TEMP = $CFG_BASEPATh."/temp";
==============================================
7.重新编制Mysql数据库表格
#mysql -u root -p
mysql>use vpopmail;
mysql>alter table vpopmail drop primary key;
mysql>alter table vpopmail add column pw_id int(5) NOT NULL primary key auto_increment;
mysql>create table address (
id int(11) unsigned NOT NULL auto_increment,
pw_id int(5) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
email varchar(128) NOT NULL default '',
UNIQUE KEY id