- 论坛徽章:
- 0
|
1. 软件环境:
RedHat AS 3.0 Update 3
以下文件放到/usr/local/pkgs目录下,
qmail-1.03.tar.gz
autorespond-2.0.2.tar.gz
cmd5checkpw-0.22.tar.gz
qmailadmin-1.2.0.tar.gz
qmailadmin-help-1.0.8.tar.gz
vpopmail-5.4.8.tar.gz
ezmlm-0.53.tar.gz
ezmlm-idx-0.40.tar.gz
ezmlm-idx-0.53.400.unified_41.patch
wmail-1.00rc1.20030724.tar.gz
empf-1.0.tar.gz
ucspi-tcp-0.88.tar.gz
ucspi-tcp-0.88.a_record.patch
ucspi-tcp-0.88.errno.patch
ucspi-tcp-0.88.nobase.patch
以下文件放到/usr/local/pkgs/patch目录下,
spamcontrol-2317.tgz
以下文件放到/usr/local/pkgs目录下,
mysql-4.1.7.tar.gz
httpd-2.0.55.tar.gz
以下文件放到/usr/local/pkgs/clamav目录下,
qmail-scanner-1.24.gz
maildrop-1.5.2.tar.gz
clamav-0.80.tar.gz
perl-DB_File-1.804-88.4.i386.rpm
perl-suidperl-5.8.0-88.3.i386.rpm
perl-Time-HiRes-1.38-3.i386.rpm
compat-db-4.1.25-6.i386.rpm
注:以上软件都可以通过google.com搜索到可用的下载地址。
2. 设置Qmail环境
groupadd nofiles
groupadd qmail
useradd –g nofiles –d /var/qmail/alias alias
useradd –g nofiles –d /var/qmail qmaild
useradd –g nofiles –d /var/qmail qmaill
useradd –g nofiles –d /var/qmail qmailp
useradd –g qmail –d /var/qmail qmailq
useradd –g qmail –d /var/qmail qmailr
useradd –g qmail –d /var/qmail qmails
cd /var/qmail/alias
touch .qmail-postmaster .qmail-root .qmail-mailer-daemon
3. 安装Qmail+SpamControl+eMPF
cd /usr/local/pkgs/patch
tar zxvf spamcontrol-2317.tgz
cd /usr/local/pkgs
tar zxvf qmail-1.03.tar.gz
cd qmail-1.03
cp –aR ../patch/* .
使用vi命令编辑conf-spamcontrol文件,然后保存退出,执行:
./install_spamcontrol.sh
执行如下执行命令,用以安装eMPF-1.0
cd /usr/local/pkgs
tar zxvf empf-1.0.tar.gz
cp -aR empf-1.0/* qmail-1.0.3,注意不要覆盖README文件。
cd qmail-1.03
cp qmail-smtpd.c qmail-smtpd.c.orig,把qmail-smtpd.c做个备份
使用vi命令编辑qmail-smtpd.c文件,找到如下一行:
void smtp_rcpt(arg) char *arg; {
在该行下新增一行,如下:
int ret = 0;
然后,找到如下四行:
if (!stralloc_cats(&rcptto,"T")) die_nomem();
if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
if (!stralloc_0(&rcptto)) die_nomem();
out("250 ok\r\n");
把这四行删除,替换成如下:
ret = policy_check();
if (ret == 1) {
if (!stralloc_cats(&rcptto,"T")) die_nomem();
if (!stralloc_cats(&rcptto,addr.s)) die_nomem();
if (!stralloc_0(&rcptto)) die_nomem();
out("250 ok\r\n");
}
else if (ret == 0) {
out("550 cannot message ");
out(addr.s);
out(" (#5.0.0 denied by policy)\r\n");
}
else {
out("454 cannot message ");
out(addr.s);
out(" (#4.3.0 broken policy)\r\n");
}
保存qmail-smtpd.c,退出。
编辑Makefile文件,在最后加入如下几行:
policy.o: \
policy.c policy.h conf-policy
./compile policy.c `head -1 conf-policy`
找到如下几行:
qmail-smtpd: \
load qmail-smtpd.o rcpthosts.o commands.o timeoutread.o qregex.o \
timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o received.o \
date822fmt.o now.o qmail.o cdb.a fd.a wait.a datetime.a getln.a \
open.a sig.a case.a env.a stralloc.a alloc.a strerr.a substdio.a error.a str.a \
fs.a auto_qmail.o base64.o policy.o socket.lib vpopmail.lib
./load qmail-smtpd rcpthosts.o commands.o timeoutread.o qregex.o \
timeoutwrite.o ip.o ipme.o ipalloc.o control.o constmap.o \
received.o date822fmt.o now.o qmail.o cdb.a fd.a wait.a \
datetime.a getln.a open.a sig.a case.a env.a strerr.a stralloc.a \
alloc.a substdio.a error.a str.a fs.a auto_qmail.o base64.o policy.o `cat \
socket.lib` `cat vpopmail.lib`
在base64.o和socket.lib之间加上policy.o,共有两个地方。
保存Makefile,退出。
执行如下命令,编译qmail-1.03
make setup check
./config-fast mail.yourdomain.com
echo “” > /var/qmail/control/locals
echo “mail.doingwin.com” >> /var/qmail/control/rcpthosts
4. 安装autorespond
cd /usr/local/pkgs
tar zxvf autorespond-2.0.2.tar.gz
cd autorespond-2.0.2
make
make install
5. 安装cmd5checkpw
cd /usr/local/pkgs
tar zxvf cmd5checkpw-0.22.tar.gz
cd cmd5checkpw-0.22
mkdir –p /usr/man/man8
make
make install
6. 安装uscpi-tcp
cd /usr/local/pkgs
tar zxvf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch –p1
patch –p1
patch –p1
make setup check
7. 安装ezmlm
cd /usr/local/pkgs
tar zxvf ezmlm-idx-0.40.tar.gz
tar zxvf ezmlm-0.53.tar.gz
mv ezmlm-idx-0.40/* ezmlm-0.53/
cd ezmlm-0.53
patch –p0
patch
make
make setup
8. 安装MySQL
useradd –d /dev/null –s /bin/false mysql
cd /usr/local/pkgs
tar zxvf mysql-4.1.7.tar.gz
cd mysql-4.1.7
CFLAGS="-O2 -mcpu=pentiumpro" CXX=gcc CXXFLAGS="-O2 \
-mcpu=pentiumpro -felide-constructors" \
./configure \
--prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile \
--enable-assembler --disable-shared \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static
make
make install
cd /usr/local/mysql/bin
./mysql_install_db –user=mysql
cd /usr/local/mysql/share/mysql
cp mysql.server /etc/rc.d/init.d/mysql
chmod 755 /etc/rc.d/init.d/mysql
chkconfig –add mysql
chkconfig mysql on
service mysql start
9. 安装vpopmail
groupadd vchkpw
useradd –g vchkpw vpopmail
make ~vpopmail/etc
echo "localhost|0|vpopmailuser|vpoppasswd|vpopmail" > ~vpopmail/etc/vpopmail.mysql
chown vpopmail.vchkpw ~vpopmail/etc/vpopmail.mysql
chmod 640 ~vpopmail/etc/vpopmail.mysql
以root身份登陆mysql,执行:
CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.*
TO vpopmailuser@localhost IDENTIFIED BY 'vpoppasswd';
exit;
cd /usr/local/pkgs
tar zxvf vpopmail-5.4.8.tar.gz
cd vpopmail-5.4.8
./configure \
--disable-roaming-users \
--enable-logging=p \
--disable-ip-alias-domains \
--disable-passwd \
--enable-clear-passwd \
--disable-domain-quotas \
--enable-auth-module=mysql \
--disable-many-domains \
--enable-auth-logging \
--enable-mysql-logging \
--enable-valias
make
make install-strip
最后执行:
chmod 755 ~vpopmail/
chmod 6755 ~vpopmail/bin/vchkpw
echo “doingwin.com” > /home/vpopmail/etc/defaultdomain
echo “127.:allow,RELAYCLIENT=\"\"” > /home/vpopmail/etc/tcp.smtp
echo “:allow” >> /home/vpopmail/etc/tcp.smtp
tcprules tcp.smtp.cdb tcp.smtp.tmp
10. 安装Apache
cd /usr/local/pkgs
tar zxvf httpd-2.0.55.tar.gz
cd httpd-2.0.55
./configure --prefix=/usr/local/apache
make
make install
11. 安装qmailadmin
cd /usr/local/pkgs
tar zxvf qmailadmin-1.2.0.tar.gz
cd qmailadmin-1.2.0
./configure --enable-help
make
make install-strip
cd ..
tar zxvf qmailadmin-help-1.0.8.tar.gz
cd qmailadmin-help-1.0.8
mkdir /var/www/html/images/qmailadmin/help
cp -rp * /var/www/html/images/qmailadmin/help
12. 安装wmail
cd /usr/local/pkgs
tar zxvf wmail-1.00rc1.20030724.tar.gz
cd wmail-1.00rc1.20030724
./configure --prefix=/usr/local/wmail \
--enable-cgibindir=/var/www/cgi-bin \
--enable-imagedir=/var/www/html/images \
--enable-imageurl=/images \
--with-cachedir=/usr/local/wmail/var/cache \
--enable-webpass=yes \
--without-ispell \
--with-maxmsgsize=5242880 --with-maxformargsize=5000000\
--enable-maxpurge=7 \
--without-authpam --without-authuserdb --without-authpwd \
--without-authshadow --without-authldap \
--without-authdaemon --with-authvchkpw \
--with-defaultlang=zh-cn --enable-unicode \
--with-fcgi \
--enable-https=auto \
--with-cacheowner=vpopmail \
--disable-autorenamesent
make configure-check
make
make check
make install-strip
make install-configure
13. Qmail启动脚本
#!/bin/sh
# qmail-smtpd startup with SMTP Authentication + vpopmail
QMAILDUID=`id -u qmaild`
QMAILDGID=`id -g qmaild`
HOSTNAME=`hostname`
export MFDNSCHECK=""
#export QMAILQUEUE=/var/qmail/bin/qmail-scanner-queue.pl
/bin/echo "Starting SMTP service......"
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start ./Maildir/ splogger qmail &
/usr/local/bin/tcpserver -H -R -c 100 -l $HOSTNAME -x /home/vpopmail/etc/tcp.smtp.cdb -u $QMAILDUID -g $QMAILDGID 0 smtp /usr/local/bin/rblsmtpd -rcbl.anti-spam.org.cn /var/qmail/bin/qmail-smtpd /home/vpopmail/bin/vchkpw /bin/true 2>&1 | /var/qmail/bin/splogger smtpd &
#Start POP3 service
/bin/echo "Starting POP3 service......"
/usr/local/bin/tcpserver -H -R -c 100 -l $HOSTNAME 0 pop3 /var/qmail/bin/qmail-popup doingwin.com /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1 | /var/qmail/bin/splogger pop3d &
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/3959/showart_92843.html |
|