- 论坛徽章:
- 0
|
我的配制文档为,高手看一下,这篇文档是否有问题,我配制了几次都有点问题,有一次是smtp可以验证,但pop3无法收取。
此安装指南中所使用的软件包有:
autorespond-2.0.5.tar.gz
clamav-0.83.tar.gz
courier-authlib-0.55.tar.bz2
courier-imap-4.0.2.tar.bz2
daemontools-0.76.errno.patch
daemontools-0.76.tar.gz
ezmlm-0.53.tar.gz
ezmlm-idx-0.42.tar.gz
igenus_2.0.2_20040901_release.tgz
igenus_admin_0.1.tgz
isoqlog-2.1.1.tar.gz
maildrop-1.8.0.tar.bz2
mrtg-2.10.15-1.i386.rpm
netqmail-1.05.tar.gz
perl-Razor-Agent-2.40-2.i386.rpm
perl-suidperl-5.8.5-12.1.1.i386.rpm
qlogtools_errno.patch
qlogtools-3.1.tar.gz
qmailadmin-1.2.3.tar.gz
qmailanalog-0.70.errno.patch
qmailanalog-0.70.tar.gz
qmailmrtg7-4.0.tar.gz
qmail-scanner-1.25.tgz
qmail-toaster-0.7.2.patch.bz2
qms-analog-0.4.2.tar.gz
spamassassin-3.0.2-2.1.el3.rf.i386.rpm
squirrelmail-1.4.4.tar.gz
sqwebmail-5.0.1.tar.bz2
tnef-1.2.3.1.tar.gz
toaster-scripts-0.7.tar.gz
ucspi-tcp-0.88.errno.patch
ucspi-tcp-0.88.tar.gz
vpopmail-5.4.10.tar.gz
vqadmin-2.3.6.tar.gz
vqregister-2.6.tar.gz
#解压缩netqmail-1.05.tar.gz
chmod 755 -R pkg
cd pkg
tar -xzf netqmail-1.05.tar.gz
cd netqmail-1.05
./collate.sh
注意:./collate.sh这一步不要忘
安装qmail
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
安装qmail
#创建所需要的用户
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用户
groupadd vchkpw -g 89
useradd vpopmail -u 89 -g vchkpw
#准备安装qmail
cd /home/pkg
tar -xzf toaster-scripts-0.7.tar.gz
cd netqmail-1.05/netqmail-1.05/
# 搜索函数straynewline中的451改为553
vi qmail-smtpd.c
# 当你的服务器收到无效格式的邮件时,会发送:"I am not going to accept that message at the moment,you can try again later",对方服务器收到后,几秒钟后又会发送同样的邮件给你,造成多次的重复。
# 改为553后,你的服务器将直接发送:"I am not going to accept that message,don't try sending it again.",告诉对方的服务器不要再发这封无效的信件。
# 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
#注:qmail的补丁在vpopmail安装之后再打。
# 用你自己的主机名代替下面的mail.domain.com
./config-fast mail.domain.com
#设置管理员的邮箱地址。
#发往root/postmaster/mailer-daemon地址的邮件将会由定义的管理员邮箱接收。
#将如下的“admin@domain.com"替换成你的管理员邮箱。
cd /var/qmail/alias
echo "admin@domain.com" > .qmail-postmaster
echo "admin@domain.com" > .qmail-mailer-daemon
echo "admin@domain.com" > .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
rm -rf /usr/lib/sendmail
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
# 用daemontools来启动qmail-send和qmail-smtpd
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service
#命令:
# 启动,停止,重启,查看队列等
qmailctl start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help
# 检查服务
netstat -an | grep 25
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep
#日志:
/var/log/maillog
/var/log/qmail/current
/var/log/qmail/pop3d/current
/var/log/qmail/pop3ds/current
/var/log/qmail/smtpd/current
我建议重新回顾一下刚才我们所做的步骤以熟悉对qmail的安装. 下面我们将开始vpopmail的安装.
第五节:安装vpopmail
TOP
vpopmail是一个以qmail为基础的虚拟域管理包;其允许在一个IP地址添加多个虚拟域;并且可以不需要使用系统帐号做邮件帐号。
参考:
http://vpopmail.sf.net
#创建目录:
mkdir -p /home/vpopmail/etc
# 设置默认域,红色部份改成你要设置的域。
echo "domain.com" > /home/vpopmail/etc/defaultdomain
# 设置smtp规则,关闭open relays
echo '127.0.0.1:allow,RELAYCLIENT=""' > /home/vpopmail/etc/tcp.smtp
cd /home/vpopmail/etc ; tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp
# 设置MySQL信息,第一个vpopmail是帐号,xukixu为密码,第二个vpopmail是数据库
echo "localhost|0|vpopmail|xukixu|vpopmail" > /home/vpopmail/etc/vpopmail.mysql
chmod 640 /home/vpopmail/etc/vpopmail.mysql
chown -R vpopmail.vchkpw /home/vpopmail/etc
# 在MySQL里添加vpopmail的帐号
mysql -uroot -pxukixu
CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.*
TO vpopmail@localhost IDENTIFIED BY 'xukixu';
FLUSH PRIVILEGES;
QUIT
#安装:
cd /home/pkg/
tar zxvf vpopmail-5.4.10.tar.gz
cd vpopmail-5.4.10
# 带数据库支持
./configure --enable-incdir=/usr/include/mysql --enable-libdir=/usr/lib/mysql --disable-roaming-users --enable-logging=p --disable-passwd --enable-clear-passwd --disable-domain-quotas --enable-auth-module=mysql --enable-auth-logging --enable-sql-logging --disable-valias --disable-mysql-limits --enable-learn-passwords
make
make install-strip
#管理:
echo 'export PATH=$PATH:/home/vpopmail/bin' >> /etc/profile
source /etc/profile
# 添加域,红色部份前面是域名,后面是管理员(postmaster)密码
vadddomain domain.com xukixu
# 添加用户,红色部份为注解,不用输入
vadduser -q 10485760S(邮箱大小) xukixu@domain.com(邮箱帐号) 1234(密码)
vmoduser -c 许靖(邮箱描述) xukixu@domain.com
# 设置邮箱容量达到90%的警告信息
vi /home/vpopmail/domains/.quotawarn.msg
From: 邮箱管理员
Reply-To: postmaster@domain.com
To: 邮箱用户
Subject: 邮箱空间警告
Mime-Version: 1.0
Content-Type: text/html; charset=gb2312
Content-Transfer-Encoding: base64
您的邮箱空间已经达到90%.如果想继续使用,请删除一些信件.
如果需要帮助,请联系邮箱管理员:
Email : postmaster@domain.com
# 设置邮箱已满的警告信息
echo "
邮件被拒绝,用户的邮箱空间已满
.
" > /home/vpopmail/domains/.over-quota.msg
#启动脚本:
cp /home/pkg/toaster-scripts-0.7/vpopmailctl /var/qmail/bin
ln -s /var/qmail/bin/vpopmailctl /usr/bin
chmod 755 /var/qmail/bin/vpopmailctl
#现在打上qmail的补丁:
cd /home/pkg/netqmail-1.05/netqmail-1.05
bunzip2 -c /home/pkg/qmail-toaster-0.7.2.patch.bz2 | patch -p0
make clean
make
qmailctl stop
make setup check
chown -R vpopmail:vchkpw /var/qmail/spam
#创建SSL Key
make cert
#按提示输入公司信息
[root@mail netqmail-1.05]# make cert
Generating a 1024 bit RSA private key
.............++++++
...............++++++
writing new private key to '/var/qmail/control/servercert.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:
CN
State or Province Name (full name) [Berkshire]:
GD
Locality Name (eg, city) [Newbury]:
SZ
Organization Name (eg, company) [My Company Ltd]:
Domain
Organizational Unit Name (eg, section) []:
Domain
Common Name (eg, your name or your server's hostname) []:
domain.com
Email Address []:
xukixu@domain.com
make tmprsadh
#注:这里可能要多等一会
chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
# 用"crontab -e"在crontab里增加下面这条,每天晚上更新temp keys
01 01 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2>&1
#起动qmail
qmailctl start
# 用daemontools来启动qmail-pop3d和qmail-pop3ds
ln -s /var/qmail/supervise/qmail-pop3d /service
ln -s /var/qmail/supervise/qmail-pop3ds /service
#命令:
# 启动,停止,重启,查看队列等
vpopmailctl start|stop|restart|stat|pause|cont|help
# 检查服务
netstat -an | grep 110
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep
安装选项参考:
vpopmail 5.4.10
Current settings
---------------------------------------
vpopmail directory = /home/vpopmail
uid = 89
gid = 89
roaming users = OFF --disable-roaming-users (default)
password learning = ON --disable-learn-passwords (default)
md5 passwords = ON --enable-md5-passwords (default)
file locking = ON --enable-file-locking (default)
vdelivermail fsync = OFF --disable-file-sync (default)
make seekable = ON --enable-make-seekable (default)
clear passwd = ON --enable-clear-passwd (default)
user dir hashing = ON --enable-users-big-dir (default)
address extensions = OFF --disable-qmail-ext (default)
ip alias = OFF --disable-ip-alias-domains (default)
domain quotas = OFF --disable-domainquotas (default)
auth module = mysql --enable-auth-module=mysql
mysql replication = OFF --disable-mysql-replication (default)
sql logging = ON --enable-sql-logging
mysql limits = OFF --disable-mysql-limits (default)
MySQL valias = OFF --disable-valias (default)
auth inc = -I/usr/include/mysql
auth lib = -L/usr/lib/mysql -lmysqlclient -lz -lm
system passwords = OFF --disable-passwd (default)
pop syslog = show failed attempts with clear text password
--enable-logging=p
auth logging = ON --enable-auth-logging (default)
all domains in one SQL table = --enable-many-domains (default)
#POP3和SMTP测试
用outlook测试qmail的smtp和pop3是否正常,注意由于vpopmail支持虚拟域名,所以在outlook中设置邮件帐号时,用户名后要加上域名,如demo@demo.com。smtp是带认证的,在outlook中也要作相应设置。建议先测试正常后再进行下一步安装。如果qmail出现问题,可查看mysql中的vpopmail数据库,/var/log下的mysqld和maillog日志记录,这样容易很快找出问题。
第六节:安装iGenus(可选)
TOP
iGENUS 不是一套独立的邮件系统,只是一个 Webmail 接口,需要配合 qmail+vpopmail+Mysql 使用。iGENUS 是由 PHP 写成,采用直接对 qmail 的 Maildir 进行读写操作,因而比 IMAP/POP 方式更快一点。
参考:
http://www.igenus.org
#安装:
cd /home/pkg
tar zxvf igenus_2.0.2_20040901_release.tgz -C /var/www/
cd /var/www/
rm -rf html/
mv igenus html
#建temp文件夹
mkdir /tmp/temp
chmod -R 0755 /tmp/temp
chown -R vpopmail:vchkpw /tmp/temp
mkdir /home/netdisk
chmod -R 0755 /home/netdisk
chown -R vpopmail:vchkpw /home/netdisk
chmod -R 0755 /var/www/html/
chown -R vpopmail:vchkpw /var/www/html/
#修改httpd.conf
vi /etc/httpd/conf/httpd.conf
User vpopmail
Group vchkpw
DocumentRoot "/var/www/html/"
AddDefaultCharset GB2312 //使默认页面为中文
/etc/rc.d/init.d/httpd restart //重启apache,使修改生效
#修改config_inc.php文件
cd /var/www/html/config
vi config_inc.php
$CFG_BASEPATH = "/var/www/html/";
\\改成你安装的目录
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail'; \\vpopmail访问mysql的帐号
$CFG_MYSQL_PASS = 'xukixu'; \\vpopmail访问mysql的密码
$CFG_MYSQL_DB = 'vpopmail';
\\数据库
$CFG_TEMP = "/tmp/temp"; \\删除$CFG_BASEPATH,并修改路径
#重新编制Mysql数据库表格
#删除之前创建的域名
vdeldomain domain.com
#编辑数据库:
mysql -uroot -pxukixu
use vpopmail;
drop table lastauth;
drop table vpopmail;
quit;
#编辑/var/www/html/docs/iGENUS.sql
vi /var/www/html/docs/iGENUS.sql
# phpMyAdmin SQL Dump
# version 2.5.3
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 04, 2004 at 11:26 AM
# Server version: 3.23.55
# PHP Version: 4.3.0
#
# Database : `vpopmail`
#
# --------------------------------------------------------
#
# Table structure for table `address`
#
use vpopmail; //加入这一行
CREATE TABLE `address` (
`id` int(11) unsigned NOT NULL auto_increment,
`pw_id` int(5) NOT NULL default '0',
`name` varchar(64) NOT NULL default '',
`email` varchar(12 NOT NULL default '',
UNIQUE KEY `id` (`id`),
KEY `pw_id` (`pw_id`)
) TYPE=MyISAM PACK_KEYS=1 ;
# --------------------------------------------------------
。。。。。。。。。
。。。。。。。。。。
CREATE TABLE `vpopmail` (
`pw_id` int(5) unsigned NOT NULL auto_increment,
`pw_name` varchar(32) NOT NULL default '',
`pw_domain` varchar(64) NOT NULL default '',
`pw_passwd` varchar(40) NOT NULL default '',
`pw_uid` int(11) default NULL,
`pw_gid` int(11) default NULL,
`pw_gecos` varchar(4 default NULL,
`pw_dir` varchar(255) default NULL,
`pw_shell` varchar(20) default NULL,
`pw_clear_passwd` varchar(16) default NULL, \\加入这一行
`createtime` timestamp(14) NOT NULL,
PRIMARY KEY (`pw_id`),
KEY `pw_name` (`pw_name`,`pw_domain`)
) TYPE=MyISAM PACK_KEYS=1 ;
#运行如下命令导入数据表
mysql -uroot -pxukixu </var/www/html/docs/iGENUS.sql
#设置igenus 定义允许上传下载的邮件的大小
#编辑/etc/php.ini
vi /etc/php.ini
max_execution_time=60
memory_limit=20M
post_max_size = 10M
file_uploads=on
upload_max_filesize=10M
register_globals=On
session.bug_compat_42=0
session.bug_compat_warn=0
sendmail_path = /var/qmail/bin/qmail-inject
#编辑/etc/http/conf/httpd.conf
vi /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mail.domain.com
DocumentRoot /var/www/html
</VirtualHost>
chmod 777 /var/lib/php/session/ -R
#重启apache:
service httpd restart
#如果需要,用vadddomain和vadduser添加新域名和新用户。
最后打开浏览器,输入http://domain.com/,就可以访问网站了。
第七节:安装iGenus_Admin(可选)
TOP
一个基于Web的vpopmail域和帐号管理工具。
参考:
http://www.igenus.org
#安装
cd /home/pkg
tar -xzvf igenus_admin_0.1.tgz -C /var/www/html/
#设置
vi /var/www/html/admin/includes/config_inc.php
<?php
/*-
* iGENUS webmail
*
* Copyright (c) 1999-2002 by iGENUS Org.
* All rights reserved.
* Author: Wu Qiong <wuqiong@sczg.com>
*
* $Id: config_inc.php,v 1.11 2004/03/23 13:59:12 wuqiong Exp $
*/
if(!defined("INCLUDE_CONFIG_OK" ) {
define("INCLUDE_CONFIG_OK","TRUE" ;
/* gid flags defind by vpopmail.h */
// define('NO_PASSWD_CHNG',0x01);
define('NO_POP', 0x02);
define('NO_WEBMAIL', 0x04);
// define('NO_IMAP', 0x0 ;
// define('BOUNCE_MAIL', 0x10);
// define('NO_RELAY', 0x20);
// define('NO_DIALUP', 0x40);
// define('V_USER0', 0x080);
// define('V_USER1', 0x100);
// define('V_USER2', 0x200);
// define('V_USER3', 0x400);
define('NO_SMTP', 0x800);
// define('QA_ADMIN', 0x1000);
$CFG_VPOPMAIL_HOST = "localhost";
$CFG_VPOPMAIL_USER = "vpopmail"; \\改为你的帐号
$CFG_VPOPMAIL_PASS = "xukixu"; \\改为你的密码
$CFG_VPOPMAIL_DB = "vpopmail";
$CFG_VPOPMAIL_TABLE = "vpopmail";
$CFG_ADMIN_TABLE = "admin";
$CFG_LAGESITE = true;
$CFG_NUMOFPAGE = 20;
$CFG_MAILBOX['inbox'] = ".";
$CFG_MAILBOX['outbox'] = ".Outbox";
$CFG_MAILBOX['draft'] = ".Draft";
$CFG_MAILBOX['trash'] = ".Trash";
$CFG_VPOPMAIL_PATH = "/home/vpopmail"; \\改为你的vpopmail安装目录
// $CFG_VPOPMAIL_PATH = "/home2/vpopmail";
$CFG_SYSADMIN_NAME = "Admin";
$CFG_SYSADMIN_PASSWD= '$1$GvmONIco$0SwBB.mEoP3KJ5Zda7ioV0';
$CFG_SYSADMIN_PASSWD_FILE = $CFG_VPOPMAIL_PATH . "/etc/syspasswd.dat";
$CFG_TIMEOUT = 600;
$CFG_IGENUS_ADM = "iGENUS邮件系统管理";
$CFG_TEMPLATE_PATH = "template/";
}
?>
#保存退出
touch /etc/syspasswd.dat
chown -R vpopmail.vchkpw /var/www/html
chmod -R 755 /var/www/html
#登录设置页面
http://domain.com/admin/sys/用户:Admin密码Admin来登录.注意A要大写..这个管理帐号密码登录后可以改的
登录后,首先点"更新数据库"你就会看见你的域名.然后点"编辑"把"登录权限 该域管理员(Postmaster)有权登录进行用户管理"这一项打勾,确认后,就可以用
http://domain.com/admin/
来登录管理了。 |
|