一、安装httpd 服务器
1、解压并释放源码包
[root@localhost ~]# tar zxvf httpd-2.2.9.tar.gz –C /usr/src/
[root@localhost ~]# cd /usr/src/httpd-2.2.9
[root@localhost httpd-2.2.9]#
2、配置编译选项
[root@localhost httpd-2.2.9]# ./configure --prefix=/usr/local/apache2
--enable-so --enable-rewite
3、编译服务器程序
[root@localhost httpd-2.2.9]# make
4、安装已编译完成的程序
[root@localhost httpd-2.2.9]# make install
5、修改主配置文件httpd.conf
[root@localhost httpd-2.2.9]# vim /usr/local/apache2/conf/httpd.conf
ServerName www.benet.com
6、检查httpd.conf 文件的语法设置
[root@localhost ~]# /usr/local/apache2/bin/apachectl -t
7、启动、终止及重启httpd 服务
[root@localhost ~]# /usr/local/apache2/bin/apachectl
start/stop/restart
二、安装MySQL 数据库
1、创建运行MySQL 数据库的系统用户、组(如果已存在,则无需要重复创
建)
[root@localhost ~]# useradd –M –s /sbin/nologin mysql
2、解压并释放源码包,并切换至展开的源码包目录
[root@localhost ~]# tar zxvf mysql-5.0.56.tar.gz –C /usr/src/
[root@localhost ~]# cd /usr/src/mysql-5.0.56/
3、使用“./configure”命令预配置编译选项
[root@localhost mysql-5.0.56]# ./configure --prefix=/usr/local/mysql
4、编译并安装
[root@localhost mysql-5.0.56]# make
[root@localhost mysql-5.0.56]# make install
5、安装后的调整
建立配置文件
[root@localhost mysql-5.0.56]# cp support-files/my-medium.cnf
/etc/my.cnf
初始化数据库
[root@localhost mysql-5.0.56]#
/usr/local/mysql/bin/mysql_install_db --user=mysql
[root@localhost mysql-5.0.56]# chown –R root.mysql /usr/local/mysql
[root@localhost mysql-5.0.56]# chown –R mysql /usr/local/mysql/var
调整lib 库路径
[root@localhost mysql-5.0.56]# echo
“/usr/local/mysql/lib/mysql”>> /etc/ld.so.conf
[root@localhost mysql-5.0.56]# ldconfig
6、MySQL 启动控制
使用mysqld_safe 脚本安全启动服务
[root@localhost mysql-5.0.56]# /usr/local/mysql/bin/mysqld_safe
--user=mysql &
[root@localhost mysql-5.0.56]# netstat –ntpl | grep 3306
将mysqld 添加为系统服务
[root@localhost mysql-5.0.56]# cp support-files/mysql.server
/etc/init.d/mysqld
[root@localhost mysql-5.0.56]# chmod o+x /etc/init.d/mysqld
[root@localhost mysql-5.0.56]# chkconfig --add mysqld
[root@localhost mysql-5.0.56]# chkconfig mysqld on
设置MySQL 程序的执行路径
[root@localhost mysql-5.0.56]# export
PATH=$PATH:/usr/local/mysql/bin
[root@localhost mysql-5.0.56]# ezho
“PATH=$PATH:/usr/local/mysql/bin” >> /etc/profile
三、构建PHP 环境
1、解压并释放下载的PHP 源码包到“/usr/src/”目录中,并切换进入展
开的源码文件夹
[root@localhost ~]# tar zxvf php-5.2.6.tar.gz –C /usr/src/
[root@localhost ~]# cd /usr/src/php-5.2.6
2、预先配置编译时的参数
[root@localhost php-5.2.6]# ./configure --prefix=/usr/local/php5
--enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql
--with-config-file-path=/usr/local/php5
3、编译并安装
[root@localhost php-5.2.6]# make && make install
4、复制php.ini 配置文件
[root@localhost php-5.2.6]# cp php.ini-dist /usr/local/php5/php.ini
5、设置httpd.conf 文件
[root@localhost php-5.2.6]# vim /usr/local/apache2/conf/httpd.conf
……
LoadModule php5_module module/libphp5.so
……
AddType application/x-httpd-php .php
……
DiretoryIndex index.php index.html
[root@localhost ~]# /usr/local/apache2/bin/apachectl restart
6、测试PHP 运行环境
[root@localhost ~]# vim /usr/local/apache2/htdocs/test.php
<?php
Phpinfo();
?>
[root@localhost ~]# /usr/local/apache2/bin/apachectl restart
有了该测试网页文件以后,就可以在浏览器中访问
http://www.benet.com/test.php 进行测试了
四、构建Postfix 邮件服务器(一)
(一)、编译安装Postfix
1、创建运行postfix 服务的用户(postfix)、(postfix、postdrop)
[root@localhost ~]# groupadd –g 1200 postdrop
[root@localhost ~]# groupadd –g 1000 postfix
[root@localhost ~]# useradd –M –u 1000 –g postfix –G postdrop –s
/sbin/nologin postfix
2、解压并释放源码包,合并补丁包
[root@localhost ~]# tar zxvf postfix-2.4.6.tar.gz
[root@localhost ~]# gunzip postfix-2.4.6-vda-ng.patch.gz
[root@localhost ~]# cd postfix-2.4.6
[root@localhost postfix-2.4.6]# patch –p1
< ../postfix-2.4.6-vda-ng.patch
3、预配置编译参数
[root@localhost postfix-2.4.6]# make makefiles ‘CCARGS=-DHAS_MYSQL
–I/usr/local/mysql/include/mysql –DUSE_SASL_AUTH –DUSE_CYRUS_SASL
–I/usr/include/sasl’ ‘AUXLIBS=-L/usr/local/mysql/lib/mysql
–lmysqlclient –lz –lm –L/usr/lib/sasl2 –lsasl2’
4、编译并进行安装
[root@localhost postfix-2.4.6]# make && make install
5、Postfix 的配置文件
[root@localhost postfix-2.4.6]# postconf
[root@localhost postfix-2.4.6]# cd /etc/postfix
[root@localhost postfix]# postconf –n > main2.cf
[root@localhost postfix]# mv main.cf main.cf.bak
[root@localhost postfix]# mv main2.cf main.cf
[root@localhost postfix]# cat main.cf
6、Postfix 的启动控制
[root@localhost postfix]# postfix start/check/reload/stop
[root@localhost postfix]# netstat –anpt | grep :25
(二)、配置并测试Postfix 服务器
1、编辑main.cf 文件,调整Postfix 的基本运行参数
[root@localhost ~]# vim /etc/postfix/main.cf
inet_interfaces = 173.17.17.17, 127.0.0.1
myhostname = mail.benet.com
mydomain = benet.com
myorigin = $mydomain
mydestination = $mydomain, $myhostname
home_mailbox = Maildir/
[root@localhost ~]# postfix reload
2、添加邮件用户的账号
[root@localhost ~]# groupadd mailusers
[root@localhost ~]# useradd –g mailusers –s /sbin/nologin xiaoqi
[root@localhost ~]# useradd –g mailusers –s /sbin/nologin lisi
[root@localhost ~]# passwd xiaoqi
[root@localhost ~]# passwd lisi
3、SMTP 发送邮件测试
[root@localhost ~]# telnet localhost 25
……
helo localhost
……
mail from: xiaoqi@benet.com
……
rect to: lisi@benet.com
……
Data
……
Subject: (输入新建的内容,最后以点号“.”结束)
……
.
quit
(三)、构建Dovecot 服务器
1、编译安装Dovecot 软件包
[root@localhost ~]# useradd –M –s /sbin/nologin dovecot
[root@localhost ~]# tar zxvf dovecot-1.1.4.tar.gz
[root@localhost ~]# cd dovecot-1.1.4
[root@localhost dovecot-1.1.4]# ./configure --sysconfig=/etc
--with-mysql
[root@localhost dovecot-1.1.4]# make && make install
2、配置Dovecot 的运行参数
建立dovecot.conf 配置文件并进行简单设置
[root@localhost dovecot-1.1.4]# cp /etc/dovecot-example.conf
/etc/dovecot.conf
[root@localhost dovecot-1.1.4]# vim /etc/dovecot.conf
ssl_disable = yes (87 行)
protocols = pop3 imap (23)
disable_plaintext_auth = no (47)
mail_location = maildir:~/Maildir (214)
创建PAM 认证文件
[root@localhost ~]# vim /etc/pam.d/dovecot
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
3、启动Dovecot 服务,并验证其监听的TCP 端口(110、143)
[root@localhost ~]# /usr/local/sbin/dovecot –c /etc/dovecot.conf
4、POP3 接受邮件测试
[root@localhost ~]# telnet localhost 110
……
user lisi
……
pass 123456
……
list
……
retr 1
……
quit
(四)、Webmail 邮件界面
1、依次安装程序包、中文语言包
[root@localhost ~]# tar jxvf squirrelmail-1.4.13.tar.bz2 –C
/usr/local/apache2/htdocs/
[root@localhost ~]# cd /usr/local/apache2/htdocs/
[root@localhost htdocs]# mv squirrelmail-1.4.13 webmail
[root@localhost htdocs]# cd webmail
[root@localhost webmail]# tar jxvf ~/zh_CN-1.4.13-20071220.tar.bz2
2、创建及调整数据目录、附件目录
[root@localhost webmail]# mkdir –p attach data
[root@localhost webmail]# chown –R daemon:daemon attach/ data/
[root@localhost webmail]# chmod 730 attach/
3、建立config.php 配置文件
[root@localhost webmail]# cp config/config_default.php
config/config.php
[root@localhost webmail]# vim config/config.php
$squirrelmail_default_language = ‘zh_CN’; (1000 行)
$default_charset = ‘zh_CN.UTF-8’; (1015)
$domain = ‘benet.com’; (118)
$smtpServerAddress = ‘localhost’; (146)
$smtpPort = 25; (151)
$imap_server_type = ‘dovecot’; (231)
$imapPort = 143; (210)
$data_dir = ‘/usr/local/apache2/htdocs/webmail/data/’; (487)
$p_w_upload_dir = ‘/usr/local/apache2/htdocs/webmail/attach/’; (505)
4、启动httpd 服务,并在浏览器中登录SquirrlMail 系统
[root@localhost webmail]# /usr/local/apache2/bin/apachectl restart
访问http://mail.benet.com/webmail/,在web 登录页面中输入邮件用户账号
名及密码进行验证
(五)、设置SMTP 的用户认证
1、设置Cyrus SASL 函数库
[root@localhost ~]# cp /usr/lib/sasl2/Sendmail.conf
/usr/lib/sasl2/smtpd.conf
[root@localhost ~]# vim /usr/lib/sasl2/smtpd.conf
pwcheck_method: saslauthd
[root@localhost ~]# service saslauthd start
[root@localhost ~]# chkconfig –level 35 saslauthd on
2、修改main.cf 配置文件,添加SMTP 认证相关的配置参数,并重新加载
配置
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
mynetworks = 127.0.0.1
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination
[root@localhost ~]# postfix reload
3、测试SMTP 发信认证
[root@localhost ~]# printf “xiaoqi” | openssl base64
[root@localhost ~]# printf “123456” | openssl base64
[root@localhost ~]# telnet mail.benet.com 25
……
ehlo localhost
……
mail from: xiaoqi@benet.com
……
rcpt to: xiaoqi@accp.com
……//会报554 的错
auth login
……
//用户名“xiaoqi”的BASE64 编码
……
//密码“123456”的BASE64 编码
……
mail from: xiaoqi@benet.com
……
rcpt to: xiaoqi@accp.com
……
data
……
(六)、设置用户别名与邮件群组
1、Postfix 的查询表
[root@localhost ~]# vim /etc/postfix/main.cf
Alias_maps = hash:/etc/aliases
[root@localhost ~]# postfix reload
2、设置邮件别名实现群发功能
[root@localhost ~]# vim /etc/aliases
Student: zhangsan, lisi, mike, john
[root@localhost ~]# newaliases //更新到“/etc/aliases.db”数据库文件
(七)、设置邮件大小、邮箱空间限制
1、限制用户可发送的邮件大小
[root@localhost ~]# vim /etc/postfix/main.cf
Message_size_limit = 20971520 //默认单位是KB
[root@localhost ~]# postfix reload
2、限制用户的邮箱空间大小
mailbox_size_limit 配置参数
(默认的限制值为50MB,对系统用户起作用)
virtual_mailbox_limit 配置参数
(默认值为50MB,对使用Mailbox 或Maildir 存储方式的用户都起作用)
quota 磁盘配额功能
(对使用Mailbox 或Maildir 存储方式的用户都起作用)
五、构建Postfix 邮件服务器(二)
(一)、配置Postfix 支持虚拟用户
1、建立虚拟用户数据库
[root@localhost ~]# service mysqld restart
[root@localhost ~]# tar zxvf extman-0.2.5/docs
[root@localhost ~]# cd extman-0.2.5/docs
[root@localhost docs]# mysql –u root –p < extmail.sql
[root@localhost docs]# mysql –u root –p < init.sql
2、修改Postfix 的配置
[root@localhost docs]# vim /etc/postfix/main.cf
#mydestination = $mydomain, $myhostname
virtual_mailbox_base = /mailbox
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps =
mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains =
mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1200
[root@localhost docs]# cp mysql_virtual_* /etc/postfix/
[root@localhost docs]# postfix reload
3、为虚拟用户设置SMTP 发信认证
1) 编译安装courier-authlib 软件包
[root@localhost ~]# tar jxvf courier-authlib-0.60.2.tar.bz2
[root@localhost ~]# cd courier-authlib-0.60.2
[root@localhost courer-authlib-0.60.2]# ./configure
--prefix=/usr/local/courier-authlib –without-stdheaderdir
--with-authmysql –with-redhat
--with-mysql-libs=/usr/local/mysql/lib/mysql
--with-mysql-includes=/usr/local/mysql/include/mysql
[root@localhost courer-authlib-0.60.2]# make && make install
[root@localhost courer-authlib-0.60.2]# make install-configure
(安装编译之前要确认mysql 的rpm 包已被卸载掉,否则容易报错)
2) 修改courier-authlib 相关配置,并启动服务
将courier-authlib 的库文件路径添加到系统的搜索路径中
[root@localhost courer-authlib-0.60.2]# vim /etc/ld.so.conf
/usr/local/courier-authlib/lib/courier-authlib
[root@localhost courer-authlib-0.60.2]# ldconfig
修改authdaemonrc 主配置文件,仅保留authmysql 认证方式,去掉其他方式
[root@localhost courer-authlib-0.60.2]# cd
/usr/local/courier-authlib/etc/authlib/
[root@localhost authlib]# cp authdaemonrc authdaemonrc.bak
[root@localhost authlib]# vim authdaemonrc
authmodulelist = “authmysql” (27 行)
authmodulelistorig = “authmysql” (34)
修改authmysqlrc 文件,用于描述如何向MySQL 数据库查询信息
[root@localhost authlib]# cp authmysqlrc authmysqlrc.bak
[root@localhost authlib]# vim authmysqlrc
MYSQL_SERVER localhost (36 行)
MYSQL_USERNAME extmail (27)
MYSQL_PASSWORD extmail (28)
MYSQL_SOCKET /tmp/mysql.sock (49)
MYSQL_DATABASE extmail (68)
MYSQL_USER_TABLE mailbox (83)
MYSQL_CRYPT_PWFIELD password (92)
MYSQL_UID_FIELD uidnumber (113)
MYSQL_GID_FIELD gidnumber (119)
MYSQL_LOGIN_FIELD username (128)
MYSQL_HOME_FIELD concat(‘/mailbox/’ maildir) (133)
MYSQL_NAME_FIELD name (139)
MYSQL_MAILDIR_FIELD concat(‘/mailbox/’ maildir) (150)
复制courier-authlib 脚本,并启动courier-authlib 服务
[root@localhost authlib]# cp courier-authlib.sysvinit
/etc/init.d/courier-authlib
[root@localhost authlib]# chmod 755
/etc/rc.d/init.d/courier-authlib
[root@localhost authlib]# chkconfig –level 35 courier-authlib on
[root@localhost authlib]# service courier-authlib start
3) 修改Cyrus-sasl 设置
[root@localhost authlib]# vim /usr/lib/sasl2/smtpd.conf
pwcheck_method: authdaemond
authdaemond_path:
/usr/local/courier-authlib/var/spool/authsaemon/socket
4、修改Dovecot 的配置
[root@localhost ~]# vim /etc/dovecot.conf
mail_location = maildir:/mailbox/%d/%n/Maildir (208 行)
……
auth default { (790)
mechanisms = plain
passdb sql { (899)
args = /etc/dovecot-mysql.conf (901)
} (902)
userdb sql { (962)
args = /etc/dovecot-mysql.conf (964)
} (965)
……
}
[root@localhost ~]# vim /etc/dovecot-mysql.conf
dirver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM
mailbox WHERE username = ‘%u’
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM
mailbox WHERE username = ‘%u’
[root@localhost ~]# mkdir –p /mailbox/extmail.org/postmaster/Maildir/
[root@localhost ~]# cd /mailbox/extmail.org/postmaster/Maildir/
[root@localhost Maildir]# chown –R postfix:postfix /mailbox
[root@localhost Mailbox]# dovecot
5、测试虚拟用户实现结果
[root@localhost ~]# /usr/local/courier-authlib/sbin/authtest –s
login postmaster@extmail.org extmail
(应能看到“Authentication succeeded.”的测试结果及虚拟用户相关信息)
(二)、部署ExtMail 使用界面
1、按顺序先后安装三个Perl 支持软件包
1) 解压并释放文件包
[root@localhost ~]# tar zxvf Unix-Syslog-1.1.tar.gz
[root@localhost ~]# tar zxvf DBI-1.607.tar.gz
[root@localhost ~]# tar zxvf DBD-mysql-4.011.tar.gz
2) 安装Unix-Syslog 包
[root@localhost ~]# cd Unix-Syslog-1.1
[root@localhost Unix-Syslog-1.1]# perl Makefile.PL
[root@localhost Unix-Syslog-1.1]# make && make install
3) 安装DBI 包
[root@localhost ~]# cd DBI-1.607
[root@localhost DBI-1.607]# perl Makefile.PL
[root@localhost DBI-1.607]# make && make install
4) 安装DBD-mysql 包
[root@localhost ~]# cd DBD-mysql-4.011
[root@localhost DBD-mysql-4.011]# perl Makefile.PL
[root@localhost DBD-mysql-4.011]# make && make install
2、安装并配置ExtMail 套件
1) 解压并释放extmail 文件包到Apache 服务器的Web 文档根目录中
[root@localhost ~]# tar zxvf extmail-1.0.5.tar.gz –C
/usr/local/apache2/htdocs
[root@localhost ~]# cd /usr/local/apache2/htdocs
[root@localhost htdocs]# mv extmail-1.0.5 extmail
2) 调整cgi 子目录的属主和属组,以便Apache 服务器有权限执行suexec 操作
[root@localhost htdocs]# cd extmail
[root@localhost extmail]# chown –R postfix:postfix cgi
3) 建立webmail.cf 配置文件
[root@localhost extmail]# cp webmail.cf.default webmail.cf
[root@localhost extmail]# vim
/usr/local/apache2/htdocs/extmail/webmail.cf
SYS_CONFIG = /usr/local/apache2/htdocs/extmail/ (2 行)
SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang (5)
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html (8)
SYS_MAILDIR_BASE = /mailbox (112)
SYS_MYSQL_USER = extmail (124)
SYS_MYSQL_PASS = extmail (125)
SYS_MYSQL_DB = extmail (126)
SYS_MYSQL_HOST = localhost (127)
SYS_MYSQL_SOCKET = /tmp/mysql.sock (128)
3、调整httpd.conf 文件中的配置(添加一个虚拟主机),并重启httpd
服务程序
[root@localhost ~]# vim /usr/local/apache2/conf/httpd.conf
NamwVirtualHost 173.17.17.11
<VirtualHost 173.17.17.11>
ServerName mail.benet.com
DocumentRoot /usr/local/apache2/htdocs/extmail/html/
ScriptAlias /extmail/cgi/
/usr/local/apache2/htdocs/extmail/cgi/
Alias /extmail /usr/local/apache2/htdocs/extmail/html/
SuexecUserGroup postfix postfix
</VirtualHost>
[root@localhost ~]# /usr/local/apache2/bin/apachectl restart
4、登录并使用ExtMail 邮件系统
在浏览器中访问http://mail.benet.com,虚拟邮件域为“extmail.org”,邮
件账号postmaster@extmail.org,密码“extmail”
(三)、部署Extman Web 管理界面
1、安装perl 支持软件包GD、File-Tail 及rrdtool 绘图引擎工具
1) 解压并释放文件包
[root@localhost ~]# tar zxvf GD-2.41.tar.gz
[root@localhost ~]# tar zxvf File-Tail-0.99.3.tar.gz
2) 安装GD 包
[root@localhost ~]# cd GD-2.41
[root@localhost GD-2.41]# perl Makefile.PL
[root@localhost GD-2.41]# make && make install
3) 安装File-Tail 包
[root@localhost ~]# cd File-Tail-0.99.3
[root@localhost File-Tail-0.99.3]# perl Makefile.PL
[root@localhost File-Tail-0.99.3]# make && make install
4) 安装rrdtool 绘图引擎工具
[root@localhost ~]# rpm –ivh rrdtool-1.2.23-3.e15.i386.rpm
[root@localhost ~]# rpm –ivh rrdtool-perl-1.2.23-3.e15.i386.rpm
2、安装并配置Extman 套件
1) 解压并释放Extman 文件包到Apache 服务器的Web 文档根目录中
[root@localhost ~]# tar zxvf extman-0.2.5.tar.gz –C
/usr/local/apache2/htdocs/
[root@localhost ~]# cd /usr/local/apache2/htdocs/
[root@localhost htdocs]# mv extman-0.2.5 extman
2) 调整cgi 子目录的属主和属组,以便Apache 服务器有权限执行suexec 操作
[root@localhost htdocs]# chown –R postfix:postfix
/usr/local/apache2/htdocs/extman/cgi
3) 创建系统临时会话保存目录,并将属主、属组设置为postfix、postfix
[root@localhost htdocs]# mkdir /tmp/extman
[root@localhost htdocs]# chown –R postfix:postfix /tmp/extman
4) 修改webman.cf 配置文件
[root@localhost extmail]# vim
/usr/local/apache2/htdocs/extman/webman.cf
SYS_CONFIG = /usr/local/apache2/htdocs/extman/ (2 行)
SYS_LANGDIR = /usr/local/apache2/htdocs/extman/lang (5)
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extman/html (8)
SYS_MAILDIR_BASE = /mailbox (12)
SYS_MYSQL_USER = webman (127)
SYS_MYSQL_PASS = webman (128)
SYS_MYSQL_DB = extmail (129)
SYS_MYSQL_HOST = localhost (130)
SYS_MYSQL_SOCKET = /tmp/mysql.sock (131)
3、调整httpd.conf 文件中的配置(添加extman 相关目录的别名设置),
并重启httpd 服务程序
[root@localhost htdocs]# vim /usr/local/apache2/conf/httpd.conf
NamwVirtualHost 173.17.17.11
<VirtualHost 173.17.17.11>
ServerName mail.benet.com
DocumentRoot /usr/local/apache2/htdocs/extmail/html/
ScriptAlias /extmail/cgi/
/usr/local/apache2/htdocs/extmail/cgi/
Alias /extmail /usr/local/apache2/htdocs/extmail/html/
ScriptAlias /extman/cgi/ /usr/local/apache2/htdocs/extman/cgi/
Alias /extman /usr/local/apache2/htdocs/extman/html/
SuexecUserGroup postfix postfix
</VirtualHost>
[root@localhost ~]# /usr/local/apache2/bin/apachectl restart
4、登录并管理Extman 邮件系统
在浏览器中访问http://mail.benet.com/extman/,邮件管理员账号
root@extmail.org,密码“extmail*123*”
5、查看邮件系统的图形化日志信息
[root@localhost ~]# ln –sf
/usr/local/apache2/htdocs/extman/addon/mailgraph_ext/mailgraph-ini
/usr/sbin/
[root@localhost ~]# ln –sf
/usr/local/apache2/htdocs/extman/addon/mailgraph_ext/qmonitor-init
/usr/sbin/
[root@localhost ~]# cp –a
/usr/local/apache2/htdocs/extman/addon/mailgraph_ext /usr/local
[root@localhost ~]# mailgraph-init start
[root@localhost ~]# qmonitor start
[root@localhost ~]# echo “/usr/sbin/mailgraph-init start” >>
/etc/rc.d/rc/local
[root@localhost ~]# echo “/usr/sbin/qmoonitor-init start” >>
/etc/rc.d/rc/local
(四)、基于邮件地址的过滤
1、根据客户端的主机名/地址过滤邮件
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
[root@localhost ~]# vim /etc/postfix/access
192.168.4 REJECT
192.168.4.1 OK
bbc.com REJECT
[root@localhost ~]# postMAP /etc/postfix/access
2、根据客户机HELO 信息中的主机名地址过滤邮件
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_invalid_hostname
[root@localhost ~]# postfix reload
3、根据发件人的地址过滤邮件
[root@localhost ~]# vim /etc/postfix/mail.cf
smtpd_sender_login_maps =
mysql:/etc/postfix/mysql_virtual_sender_maps.cf,
mysql:/etc/postfix/mysql_virtual_alias_maps.cf
smtpd_sender_restrictions =
permit_mynetworks,
reject_sender_login-mismatch,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
check_sender_access hash:/etc/postfix/sender_access
[root@localhost ~]# vim /etc/postfix/sender_access
ads@xxxx.com REJECT
marketing@ REJECT
fake.aptech.com REJECT
[root@localhost ~]# postmap /etc/postfix/sender_access
4、根据收件人的地址过滤邮件
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_non_fqdn_ recipient,
reject_unknown_recipient_domain
[root@localhost ~]# postfix restart
(五)、基于邮件内容的过滤
1、安装并配置MailScanner 扫描调度工具
1) 安装MailScanner 扫描调度工具
[root@localhost ~]# tar zxvf MailScanner-4.75.11-1.rpm.tar.gz
[root@localhost ~]# cd MailScanner-4.75.11-1
[root@localhost MailScanner-4.75.11-1]# ./install.sh
2) 修改配置文件MailScanner
[root@localhost ~]# vim /etc/MailScanner/MailScanner.conf
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA =postfix
Required SpamAssassin Score =7
High SpamAssassin Score = 10
Spam Actions = deliver header “X-Spam-Status: Yes”
High Soring Spam Actions = delete forward spam@extmail.org
3) 配置Postfix 支持调用MailScanner
[root@localhost ~]# vim /etc/postfix/main.cf
header_checks = regexp: /etc/postfix/header_checks
[root@localhost ~]# vim /etc/postfix/header_checks
/^Received:/HOLD
4) 调整邮件过滤队列的目录属主、属组,并启动MailScanner 服务程序
[root@localhost ~]# chown –R postfix.postfix
/var/spool/MailScanner/incoming
[root@localhost ~]# chown –R postfix.postfix
/var/spool/MailScanner/quarantine
[root@localhost ~]# service MailScanner start
[root@localhost ~]# chkconfig --level 35 MailScanner on
2、安装并配置SpamAssassin 垃圾邮件过滤器
1) 安装并配置SpamAssassin 垃圾邮件过滤器
[root@localhost ~]# mount /dev/cdrom /media
[root@localhost ~]# cd /media
[root@localhost media]# rpm –ivh spamassassin-3.1.7-4.e15.i386.rpm
2) 修改配置文件local.cf
(位于“/etc/mail/spamassassin/local.cf”,一般不需要进行任何修改,保
持默认设置即可)
3) 启动SpamAssassin 服务
[root@localhost ~]# service spamassassin start
[root@localhost ~]# chkconfig --level 35 spamassassin on
3、安装并配置F-Port 病毒查杀软件
1) 安装F-Port 软件包安装过程中出现提示是按回车键接受默认设置
[root@localhost ~]# tar zxvf fp-Linux-i686-ws.tar.gz –C /opt/
[root@localhost ~]# cd /opt/f-prot/
[root@localhost f-prot]# ./install-f-prot.pl
2) 升级F-Port 病毒库(服务器要能够访问Internet 互联网)
[root@localhost f-prot]# /opt/f-prot/fpupdate
[root@localhost f-prot]# crontab –e
00 8 * * * /opt/f-prot/fpupdate
[root@localhost f-prot]# service crond start
[root@localhost f-prot]# chkconfig --level 35 crond on
pdf资料下载地址: http://down.51cto.com/data/102038
转载于:https://blog.51cto.com/jiayf/342443