分享
 
 
 

Qmail实例配置详解(附带演示)

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

Qmail 1.03+Courier+vpopmail+mysql+qmailadmin+webmail安装指南

对这个演示的补充说明-- Qmail 1.03+Courier+vpopmail+mysql安装指南

请到http://gujian.sege.com.cn/mail2000 去看这个文档的演示,用户名:hup

密码: 12345

作者:古剑

摘要: 本文对Qmail用户实现MYSQL的数据库管理,同时实现多虚拟主域的邮件发送,支持POP3、IMAP,使系统能够实现千万级的用户负载,同时提供邮件用户的后台管理。在此基础上可以进一步实现WEBMAIL的收发,邮件列表的管理等等。以实现真正意义上的千万级用户支持和友好的用户接口的电子邮件系统。

硬件环境:x86兼容系统,内存128M,单网卡。建议Qmail、MYSQL、WEBMAIL分别安装在单独(或者多台)的机器上,以便实现海量邮件用户支持。本系统也在SUN SOLARIS 8上通过。

软件准备:

red hat linux 7.0 内核2.2.16以上

MySQL-3.23.38-1.src.rpm

qmail-1.03+patches-18.src.rpm

dot-forward-0.71.tar.gz

courier-imap-1.3.8.1.tar.gz

ucspi-tcp-0.88.tar.gz

vpopmail-4.10.21.tar.gz

apache_1.3.19.tar.gz

php-4.05.tar.gz

vqregister-2.5.tar.gz(在线帐号申请)

Webmail1.0.tar.gz

autorespond-1.0.0.tar.gz

ezmlm-idx

qmailadmin-0.45.tar.gz

注意:本文没有讲Vmailmgr的安装和配置,这里简单介绍它的安装中注意事项:

Vmailmgr 0.96.9.tar.gz

对它./configure 后必须修改config.h文件加入#include和#include才可以编译成功!

MYSQL的安装:

解压和安装

#rpm –ivh ./ MySQL-3.23.38-1.src.rpm

#mv /usr/src/redhat/SOURCES/mysql-3.23.38.tar.gz /tmp

#cd /tmp

#tar –zxvf mysql-3.23.38.tar.gz

#cd mysql-3.23.38

#./configure

#make

#make install

#scripts/mysql_install_db

#/usr/local/bin/safe_mysqld%26amp; 有时候要重新启动系统才能正常启动MYSQL。

#mysqladmin –uroot password yourpassword

#/usr/local/bin/mysqladmin -u root -p password 'new-password'

#/usr/local/bin/mysqladmin -u root -h gujian.sege.com.cn -p password 'new-passwor

d'

#echo /usr/local/mysql/bin/safe_mysqld%26amp; /etc/rc.d/rc.local

在/etc/ld.so.conf文件末尾添加一行:

/usr/local/lib/mysql

#ldconfig

Qmail的安装:

$TTL 86400

@ IN SOA gujian.sege.com.cn. gujian.gujian.sege.com.cn. (

1997022700 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS gujian.sege.com.cn.

IN MX 10 gujian.sege.com.cn.

gujian IN A 192.168.0.1

@ IN A 192.168.0.1

$TTL 86400

@ IN SOA gujian.sege.com.cn. gujian.gujian.sege.com.cn. (

1997022700 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS gujian.sege.com.cn.

IN MX 10 gujian.sege.com.cn.

mail IN A 192.168.0.1

# rpm -e --nodeps sendmail

#mkdir /var/qmail

# groupadd -g 1000 nofiles

# useradd -u 5000 -g nofiles -d /var/qmail/alias alias

# useradd -u 5001 -g nofiles -d /var/qmail qmaild

# useradd -u 5002 -g nofiles -d /var/qmail qmaill

# useradd -u 5003 -g nofiles -d /var/qmail qmailp

# groupadd -g 1001 qmail

# useradd -u 5004 -g qmail -d /var/qmail qmailq

# useradd -u 5005 -g qmail -d /var/qmail qmailr

# useradd -u 5006 -g qmail -d /var/qmail qmails

#rpm –ivh qmail-1.03+patches-18.src.rpm

# mv /usr/src/redhat/SOURCES/qmail-1.03.tar.gz /tmp

# mv /usr/src/redhat/SOURCES/qmail-1.03-big-dns.patch /tmp

# mv /usr/src/redhat/SOURCES/qmail-1.03-bind-interface.patch /tmp

#cd /tmp

#tar –zxvf qmail-1.03.tar.gz

#cd qmail-1.03

#patch –p1

#patch –p1

#make %26amp;%26amp; make setup check

#./config

或者运行

# cd /var/qmail/control

# echo mail.sege.com.cn me

# echo mail.sege.com.cn defaultdomain

# echo mail.sege.com.cn rcpthosts

# echo mail.sege.com.cn locals

# echo mail.sege.com.cn plusdomain

# echo localhost locals

# echo localhost rcpthosts

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

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

# cd /var/qmail/boot

# mv home ../rc

# /var/qmail/rc %26amp;

#echo /var/qmail/rc%26amp;/etc/rc.d/rc.local

# ps auxww | grep qmail and find the ``qmail-lspawn'' process together with a few others. Test the

# uname -a | mail gujian@sege.com.cn

安装.forward兼容的转发服务:

#tar –zxvf dot-forward-0.71.tar.gz

#make setup check

#cp /var/qmail/boot/home+df /var/qmail/rc

注意必须手工将rc文件的格式修改为如下:

#!/bin/sh

exec env - PATH="/var/qmail/bin:$PATH"

qmail-start '|dot-forward .forward ./Maildir' splogger qmail

这样在/home/vpopmail/domains/domainname/username/Maildir/.forward 文件就可以生效了。

安装UCSPI-TCP

# tar xzvf ucspi-tcp-0.88.tar.gz

# cd ucspi-tcp-0.88

# make %26amp;%26amp; make setup check

This will compile and install ucspi-tcp files in your /usr/local directory.

建立/etc/tcp.smtp 文件,内容为

127.0.0.:allow,RELAYCLIENT=''

192.168.1.:allow,RELAYCLIENT=''

:allow

relay 规则建立。

# tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp

让规则生效

建立SMTP服务启动脚本/usr/sbin/runsmtp,内容如下

#!/bin/sh

/usr/local/bin/tcpserver -x/etc/tcp.smtp.cdb -u5002 -g1000

0 smtp /var/qmail/bin/qmail-smtpd 2%26amp;1

| /var/qmail/bin/splogger %26amp;

#chmod +x /usr/sbin/runsmtp

#echo /usr/sbin/runsmtp /etc/rc.d/rc.local

启动SMTP服务:

#/usr/sbin/runsmtp

Checking to see if it worked

Check to see if you have done everything correctly by doing this:

# telnet mail.dexterslab.net smtp You should see:

Trying 192.168.1.1...

Connected to mail.dexterslab.net.

Escape character is ']'.

220 mail.dexterslab.net ESMTP Try saying hello. Type in

HELO johnnybravo.com It should say:

250 mail.dexterslab.net Type ``quit'' to close connection. We will do serious testing later.

设置系统别名

# cd /var/qmail/alias

# echo '%26amp;gujian' .qmail-root

# echo '%26amp;gujian' .qmail-toor

# echo '%26amp;gujian' .qmail-postmaster

# echo '%26amp;gujian' .qmail-admin

# echo '%26amp;gujian@sege.com.cn' .qmail-gujian

设置POP3:

保证系统没有开pop3服务

root@mail:# killall -HUP inetd

运行下条命令启动POP3服务:

:# /usr/local/bin/tcpserver -u0 -g0 0 110 /var/qmail/bin/qmail-popup mail.sege.com.cn /usr/local/bin/checkvpw /var/qmail/bin/qmail-pop3d Maildir 2%26amp;1 | /var/qmail/bin/splogger %26amp;

将这条命令写入/usr/sbin/runpop文件中。

#chmod +x%26#42476;%26Aacute;%26#8249;%26#1033; 勸%26iquest; %26#4096; %26#1024; %26#19544;

l %26Oslash; %26Oslash; %26Oslash; %26Oslash; %26Oslash; %26Oslash; %26Oslash; ì %26#10756; %26#10756; %26#10756; %26#10756; %26#10784; %26#338; ì 侭 %26#306; %26#10936; %26#10958; %26#10958; %26#10958; %26#10958; %26#10958; %26#10958; %26#10958; %26#19944; %26#19946; %26#19946; %26#19946; %26#19946; %26#19946; %26#19946; $ 僟 %26#544; 勿 r 与 %26#345; %26Oslash; %26#10958; %26#10958; %26#10958; %26#10958; %26#10958; 与 .smtp /home/vpopmail/etc

# tar -zxvf vpopmail-4.10.21.tar.gz

#cd vpopmail-4.10.21

#vi vmysql.h

将文件中的mysql设置为你的MYSQL配置

#crontab –e

添加以下内容:

40 * * * * /home/vpopmail/bin/clearopensmtp 2%26amp;1 /dev/null

#./configure --enable-roaming-users=y --enable-hardquota=100000000 --enable-default-domain=sege.com.cn --enable-mysql=y --enable-sqlincdir=/usr/local/include/mysql --enable-sqllibdir=/usr/local/lib/mysql --enable-ucspi-dir=../ucspi-tcp-0.88 --enable-passwd=n --enable-clear-passwd=y

#make

#make install

添加虚拟域:

#/home/vpopmail/bin/vadddomain sege.com.cn

#/home/vpopmail/bin/vadddomain china.com

添加虚拟用户:

/home/vpopmail/bin/vadduser gujian@sege.com.cn

设置支持POP3:

将/usr/sbin/runpop脚本内容改为如下内容:

/usr/local/bin/tcpserver -u vpopmail -g vchkpw 0 110 /var/qmail/bin/qmail-popu

p sege.com.cn /home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2%26amp;1

| /var/qmail/bin/splogger %26amp;

#killall –9 tcpserver

#/usr/sbin/runsmtp

#/usr/sbin/runpop

可以通过以下命令测试POP用户了:

#telnet mail.china.com 110

#telnet mail.sege.com.cn 110

安装IMAP 服务器:

#tar –zxvf courier-imap-1.3.8.1.tar.gz

#cd courier-imap-1.3.8.1

# ./configure --disable-root-check

#make

#make install

#cd /usr/lib/courier-imap/etc

# cp imapd.dist imapd

# cp imapd-ssl.dist imapd-ssl

编辑imapd 文件:

MAXPERIP: 40 (改4为40,让同一个IP地址最多可以有40个连接,为webmail的用户做准备的。)

AUTHMODULES:删除所有的模块,只留下authvchkpw

启动courier imap服务

# /usr/lib/courier-imap/libexec/imapd.rc start

将/usr/lib/courier-imap/libexec/imapd.rc start添加到/etc/rc.d/rc.local文件尾

配置apache+php+mysqladmin:

# gunzip -c apache_1.3.9.tar.gz | tar xf -

# cd apache_1.3.9

# ./configure

# cd ..

# gunzip -c php-4.0.x.tar.gz | tar xf -

# cd php-4.0.5

# ./configure --with-mysql --with-apache=../apache_1.3.9 --enable-track-vars --enable-gettext –disable-debug

# make

# make install

#cp php.ini-dist /usr/local/lib/php.ini

#cd ../apache_1.3.19

#./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a

#make

#make install

修改/www/conf/httpd.conf文件,启动apache

#/www/bin/apachectl start

vqregister-2.5.tar.gz (Web方式的在线用户申请)

#tar –zxvf vqregister-2.5.tar.gz

#cd vqregister-2.5

# vi vqregister.conf 改为合适的配置。

以下是我的文件内容:

# vQregister configuration file

#

#

# ADMINEMAIL

#

# Syntax: AdminEmail

#

# Sets the administrative contact

# for the vQregister program. Any errors

# that are generated should contain this

# email address. See the TEMPLATE file,

# and the template files.

#

AdminEmail vol@inter7.com

# REGISTERUSER

#

# Syntax: RegisterUser

#

# Sets the username on the domain the user

# is signing up for, that vQregister sends

# out when VERIFY is on. The domain is

# the user is signing up for is appended.

#

#RegisterUser vQregister

# SUBJECT

#

# Syntax: Subject

#

# Sets the subject of the message

# that vQregister will put on the

# outgoing message when VERIFY is on

#

#Subject Your new email account created by vQregister

# VERIFY

#

# Syntax: Verify

# Default: off

#

# Sets whether or not you want

# vqregister to verify email addresses

# by sending a randomly set password

# to the user's current email address.

# Checking is done to see if the email

# address exists on the remote server.

#

#Verify on

# ALLOWPASSWORD

#

# Syntax: AllowPassword

# Default: off

#

# Sets whether or not users can provide

# a password at registration time, rather

# than having one generated for them. When

# this option is enabled, users do not need

# to provide a current email address, but

# if they do, an email will be sent if

# VERIFY is on. A new feature with ALLOWPASSWORD

# is that a user must also fill in a vpass

# field to verify the password they have typed.

#

AllowPassword on

# ALLOWDOMAIN

#

# Syntax: AllowDomain

#

# Sets domain.tld as registerable by

# users. Any domains not listed here,

# cannot be signed up for.

#

AllowDomain sege.com.cn

AllowDomain china.com

# REDIRECT

#

# Syntax: Redirect

#

# If you wish to redirect your users

# to a signup success page, you may

# do this with the REDIRECT identifier.

# Otherwise, the html/success.html template

# file will be outputted.

#

# Note: The redirected URL cannot support

# templates.

#

Redirect http://gujian.sege.com.cn

# PASSWORD

#

# Syntax: Password

#

# Makes all passwords given to users be

# set to . Elimates generation

# of random passwords. For use with REDIRECT.

#

# PASSWORDLEN

#

# Syntax: PasswordLen

# Default: 8

#

# Sets the length of randomly generated

# passwords.

#

PasswordLen 8

# BADHOSTS

#

# Syntax: BadHosts

#

# Defines a filename which, contains a list of email

# addresses one cannot signup from.

#

# Example file:

# hotmail.com

# .cjb.net

# yahoo.com

# lycos.com

#

# If not defined, this feature is not turned on.

#

#BadHosts badhosts

# DB_Host

#

# Syntax: DB_Host

#

# Set where to connect for the

# database.

#

#DB_Host localhost

# DB_Name

#

# Syntax: DB_Name

#

# Defines the database name to use

# when storing demographic, or other

# information.

#

#DB_Name user_store

# DB_USER

#

# Syntax: DB_User

#

# Sets the username to use when

# connecting to the database

#

#DB_User root

# DB_PASSWORD

#

# Syntax: DB_Password

#

# Defines the password for the

# database.

#

# Note: Databases are created if they do not exist (if able)

#

#DB_Password inter7

# DB_FIELDS

#

# Syntax: DB_Fields [,[,]]

#

#DB_Fields user_info user,dom,pass,cemail,fname

# ADVERTISE

#

# Syntax: Advertise

# Default: on

#

# We're silly. Turn this off to turn off the advertisement

# at the end of the outgoing email when VERIFY is on.

#

#Advertise on

修改html目录下的文件,使他们合适你的站点。

修改Makefile文件,

将LIBS = -L$(VDIR)/lib -lvpopmail -lcrypt -L/usr/local/mysql/lib/mysql -lmysqlclie

nt

改为:LIBS = -L$(VDIR)/lib -lvpopmail -lcrypt -L/usr/local/lib/mysql -lmysqlclie

nt

#make

#make install

#cp –r /usr/local/apache/cgi-bin/vqregister /www/cgi-bin/

http://gujian.sege.com.cn/cgi-bin/vqregister/vqregister.cgi

安装WEBMAIL:

#cd /www/html

#tar –zxvf webmail.tar.gz

修改/www/webmail/config.php文件以适合你的站点就可以了。

总结:

由于本人才疏学浅错误之处难免,请大家指教。

(作者:古剑)

,

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有