Linux 邮件服务器Qmail 架设

#########################################################################################

[系统环境]: Thizlinux Server 7.0  [kernel 2.4.22-3Thiz]

[软件环境]:

httpd-2.2.0.tar.gz

mysql-4.0.26.tar.gz

php-4.4.4.tar.bz2

bind-9.2.2-13Thiz

gcc-3.3.1-5Thiz

glibc-2.3.2-82Thiz

#########################################################################################

[软件包列表]:

A. tcpserver程序[ucspi-tcp]

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

B. qmail主程序[提供smtp服务]

qmail-1.03.tar.gz

qmail-smtpd-auth-0.31.tar.gz

qmail-103.patch

qmailqueue-patch

qmail-maildir++.patch

qmail-1.03.errno.patch

qmail-1.03.qmail_local.patch

** qmail-igenus.patch.2006.0525.tgz

cmd5checkpw-0.22.tar.gz

C. vpopmail主程序[提供pop3服务]

vpopmail-5.4.6.tar.gz

D. igenus程序[web界面访问程序]

igenus_2.0.2_20040901_release.tgz

igenus_admin_0.1.tgz

E. qadmin邮件管理程序

qmailadmin-1.2.9

[简单实现步骤]:

一、前期准备:

DNS服务器搭建[过程略]:

IP地址:192.168.2.1

FQDN:mail.britepic.org、mail.avnads.cn

MX记录:     IN  MX  10  mail.britepic.org.

apache安装路径:/opt/httpd   网页路径:/var/www/html

mysql安装路径:/opt/mysql

php安装路径:/opt/httpd

── Apache+MYSQL+PHP安装配置过程见《Apache+Mysql+Php整合安装》

#service named start

#service mysqld start

#service httpd start

#mysql -u root

mysql> update mysql.user set password=password('123456') where user='root';

二、ucspi-tcp程序安装

#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. 创建qmail目录及相关用户

#mkdir -p /var/qmail/alias

#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

#cd /var/qmail/alias

#touch .qmail-root .qmail-postmaster .qmail-mailer-daemon

2. 安装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 mail.britepic.org

C. 备份sendmail及相关设置

#mv /usr/sbin/sendmail /usr/sbin/sendmail.old

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

#cp /var/qmail/bin/sendmail /usr/sbin/qmail.sendmail

#mv /etc/alternatives/mta /etc/alternatives/mta.old

#ln -s /usr/sbin/qmail.sendmail /etc/alternatives/mta

四、vpopmail安装

1. 创建vpopmail安装目录及用户

#mkdir -p /var/vpopmail/etc

#groupadd vchkpw

#useradd  -g  vchkpw  -d  /var/vpopmail  vpopmail

2. 添加mysql的vpopmail用户,用于操作vpopmail数据库

#mysql -u root -p

mysql>create database vpopmail;

mysql>grant all on vpopmail.* to vpopmail@localhost identified by '654321';

mysql>quit

3.  创建tcp.smtp文件

#vi /var/vpopmail/etc/tcp.smtp

127.0.0.1:allow,RELAYCLIENT=""

192.168.0.:allow,RELAYCLIENT=""

172.16.:allow,RELAYCLIENT=""

20.20.20.20:deny

:allow

#cd /var/vpopmail/etc

#tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp

4. 编译安装vpopmail

#tar zxvf vpopmail-5.4.6.tar.gz

#cd vpopmail-5.4.6

#./configure --prefix=/var/vpopmail --enable-auth-module=mysql --enable-libdir=/opt/mysql/lib/mysql --enable-incdir=/opt/mysql/include/mysql --enable-passwd=n -enable-tcprules-prog=/usr/local/bin/tcprules -enable-tcpserver-file=/var/vpopmail/etc/tcp.smtp --enable-vpopuser=vpopmail --enable-vpopgroup=vchkpw --enable-ip-alias-domains=n

#make

#make install-strip

# vi /var/vpopmail/etc/vlimits.default

default_quota       10485760

18 default_maxmsgcount 1000

#echo "britepic.org" > /var/vpopmail/etc/defaultdomain

#vi /var/vpopmail/etc/vpopmail.mysql

# 服务器名|端口|用户名|密码|数据库名

localhost|3306|vpopmail|654321|vpopmail

#localhost|3306|root|123456|vpopmail

5. 添加smtp认证

#chmod 4755 /var/vpopmail/bin/vchkpw

#chown root:root /var/vpopmail/bin/vchkpw

#tar zxvf /usr/src/qm/cmd5checkpw-0.22.tar.gz

#cd /usr/src/cmd5checkpw-0.22/

#make && make install

6. 添加邮件域及用户

# cd /var/vpopmail/bin

# ./vadddomain avnads.cn

# ./vadddomain britepic.org

# ./vadduser linux@britepic.org

# ./vadduser unix@avnads.cn

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyxdyx.html