在Linux AS4上架建QMAIL+反病毒垃圾模块的方法

#确认在Linux AS4没有冲突的服务(postfix/sendmail/smtpd/httpd)开启

setup

修改后reboot

#安装qmail

#创建/home/pkg/目录,存放全部所需软件

#注:qmail将被安装到/var/qmail,vpopmail将被安装到/home/vpopmail,igenus&igenus_admin将被安装到/usr/local/apps/www/igenus

mkdir /home/pkg

cd home

tar zxvf qmail_2.9.tar.gz

#安装netqmail

cd /home/pkg

tar zxvf netqmail-1.05.tar.gz

cd netqmail-1.05

./collate.sh

#安装daemontools

cd /home/pkg

tar zxvf daemontools-0.76.tar.gz

cd admin/daemontools-0.76

patch -p1 < /home/pkg/netqmail-1.05/other-patches/daemontools-0.76.errno.patch

package/install

# 验证daemontools已经正常运行

sleep 5

ps ax | grep svscan

#安装ucspi-tcp

cd /home/pkg

tar zxvf ucspi-tcp-0.88.tar.gz

cd ucspi-tcp-0.88

patch -p1 < ../ucspi-tcp-0.88.errno.patch

make

make setup check

#创建所需要的用户

mkdir /var/qmail

groupadd nofiles

useradd alias -g nofiles -d /var/qmail/alias -s /sbin/nologin

useradd qmaild -g nofiles -d /var/qmail -s /sbin/nologin

useradd qmaill -g nofiles -d /var/qmail -s /sbin/nologin

useradd qmailp -g nofiles -d /var/qmail -s /sbin/nologin

groupadd qmail

useradd qmailq -g qmail -d /var/qmail -s /sbin/nologin

useradd qmailr -g qmail -d /var/qmail -s /sbin/nologin

useradd qmails -g qmail -d /var/qmail -s /sbin/nologin

#添加vpopmail用户

#注销掉89 postfix用户

vi /etc/group

#注销掉89 postfix用户

vi /etc/passwd

groupadd vchkpw -g 89

useradd vpopmail -u 89 -g vchkpw

#准备安装qmail

cd /home/pkg

tar zxvf toaster-scripts-0.7.tar.gz

cd netqmail-1.05/netqmail-1.05/

# 搜索函数straynewline中的451改为553

# 当你的服务器收到无效格式的邮件时,会发送:"I am not going to accept that message at the moment,you can try again later",

#对方服务器盏胶螅该胫雍笥只岱⑺屯挠始悖斐啥啻蔚闹馗础?nbsp;

# 改为553后,你的服务器将直接发送:"I am not going to accept that message,don't try sending it again.",告诉对方的服务器不要再发这封无效的信件。

vi qmail-smtpd.c

# RedHat/Fedora用户可能需要为TLS补丁链接一个include文件

ln -s /usr/kerberos/include/com_err.h /usr/include/

# 删除sendmail的链接

rm -rf /usr/sbin/sendmail

#qmail编译安装

make

make setup check

# 用你自己的主机名代替下面的mail.51divx.com

./config-fast mail.51divx.com

#设置管理员的邮箱地址。

#发往root/postmaster/mailer-daemon地址的邮件将会由定义的管理员邮箱接收。

#将如下的“[email protected]"替换成你的管理员邮箱。

cd /var/qmail/alias

echo "[email protected]" > .qmail-postmaster

echo "[email protected]" > .qmail-mailer-daemon

echo "[email protected]" > .qmail-root

chmod 644 /var/qmail/alias/.qmail*

#开启SPF设置

echo ./Maildir/ >/var/qmail/control/defaultdelivery

echo 3 > /var/qmail/control/spfbehavior

#添加qmail的帮助手册

echo MANPATH /var/qmail/man >> /etc/man.config

#为qmail服务建立监控目录和日志文件:

mkdir -p /var/qmail/supervise/qmail-send/log

mkdir -p /var/qmail/supervise/qmail-smtpd/log

mkdir -p /var/qmail/supervise/qmail-pop3d/log

mkdir -p /var/qmail/supervise/qmail-pop3ds/log

cp /home/pkg/toaster-scripts-0.7/send.run /var/qmail/supervise/qmail-send/run

cp /home/pkg/toaster-scripts-0.7/send.log.run /var/qmail/supervise/qmail-send/log/run

cp /home/pkg/toaster-scripts-0.7/smtpd.run /var/qmail/supervise/qmail-smtpd/run

cp /home/pkg/toaster-scripts-0.7/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run

cp /home/pkg/toaster-scripts-0.7/pop3d.run /var/qmail/supervise/qmail-pop3d/run

cp /home/pkg/toaster-scripts-0.7/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run

cp /home/pkg/toaster-scripts-0.7/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run

cp /home/pkg/toaster-scripts-0.7/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run

echo 20 > /var/qmail/control/concurrencyincoming

chmod 644 /var/qmail/control/concurrencyincoming

chmod 755 /var/qmail/supervise/qmail-send/run

chmod 755 /var/qmail/supervise/qmail-send/log/run

chmod 755 /var/qmail/supervise/qmail-smtpd/run

chmod 755 /var/qmail/supervise/qmail-smtpd/log/run

chmod 755 /var/qmail/supervise/qmail-pop3d/run

chmod 755 /var/qmail/supervise/qmail-pop3d/log/run

chmod 755 /var/qmail/supervise/qmail-pop3ds/run

chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run

mkdir -p /var/log/qmail/smtpd

mkdir -p /var/log/qmail/pop3d

mkdir -p /var/log/qmail/pop3ds

chown -R qmaill /var/log/qmail

#启动脚本:

cd /home/pkg

cp toaster-scripts-0.7/rc /var/qmail/rc

chmod 755 /var/qmail/rc

cp toaster-scripts-0.7/qmailctl /var/qmail/bin/

chmod 755 /var/qmail/bin/qmailctl

ln -s /var/qmail/bin/qmailctl /usr/bin

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

相关推荐