第4章构建LAMP网站服务平台

1:安装HTTPD软件包

~]# ls /media/cdrom/Server/*httpd*
/media/cdrom/Server/httpd-2.2.3-6.el5.i386.rpm
/media/cdrom/Server/httpd-devel-2.2.3-6.el5.i386.rpm
/media/cdrom/Server/httpd-manual-2.2.3-6.el5.i386.rpm
/media/cdrom/Server/system-config-httpd-1.3.3.1-1.el5.noarch.rpm
[root@s1 ~]# rpm -ivh /media/cdrom/Server/httpd-2.2.3-6.el5.i386.rpm
2:[root@s1 mnt]# tar -zxvf httpd-2.2.9.tar.gz -C /usr/src/
3:配置编译选项
[root@s1 mnt]# cd /usr/src/httpd-2.2.9/
[root@s1 httpd-2.2.9]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs
4:编译服务程序和安装
[root@s1 httpd-2.2.9]# make && make install
5:在HTTPD.CONF文件中添加:SERVERNAME“配置行,设置WEB服务的域名
[root@s1 ~]# vi /usr/local/apache2/conf/httpd.conf
ServerName
6:启动、终止HTTPD服务
[root@s1 ~]# /usr/local/apache2/bin/apachectl -t
Syntax OK
[root@s1 ~]# /usr/local/apache2/bin/apachectl restart
httpd not running, trying to start
[root@s1 ~]# /usr/local/apache2/bin/apachectl start
httpd (pid 20911) already running
[root@s1 ~]# netstat -anpt |grep :80
tcp        0      0 :::80                       :::*                        LISTEN      20911/httpd    
7:构建虚拟WEB主机
(1)在HTTPD服务器的网页目录建立两个文件夹benetcom accpcom ,并分别建立两个测试网页
    [root@s1 ~]# cd /usr/local/apache2/htdocs/
[root@s1 htdocs]# mkdir benetcom accpcom
[root@s1 htdocs]# echo "" > benetcom/index.html
[root@s1 htdocs]# echo "" > accpcom/index.html
(2)修改HTTPD.CONF文件 添加虚拟主机配置
[root@s1 htdocs]# vi /usr/local/apache2/conf/httpd.conf
NameVirtualHost 172.16.16.166
<VirtualHost 172.16.16.166>
DocumentRoot /usr/local/apache2/htdocs/benetcom
ServerName
ErrorLog logs/www.benet.com.error.log
CustomLog logs/www,benet.com.access.log common
</VirtualHost>
<VirtualHost 172.16.16.166>
DocumentRoot /usr/local/apache2/htdocs/accpcom
ServerName
ErrorLog logs/www.accp.com.error.log
CustomLog logs/www,accp.com.access.log common
</VirtualHost>
(3)建立系统用户的个人主页
[root@s1 ~]# vi /usr/local/apache2/conf/httpd.conf
UserDir public_html
<Directory "/home/*/public_html">
AllowOverride none
Options none
Order allow,deny
Allow from all
</Directory
建立个人主页测试文件
[root@s1 ~]# su - huang
[huang@www ~]$ mkdir public_html
[huang@www ~]$ echo "huang's home page " >> public_html/index.html
[huang@www ~]$ ls -ld /home/huang/
drwx------ 3 huang huang 4096 Apr 29 16:16 /home/huang/
[huang@www ~]$ chmod o+x /home/huang/
[huang@www ~]$ ls -ld /home/huang/
drwx-----x 3 huang huang 4096 Apr 29 16:16 /home/huang/
在客户机浏览器中访问个人主页
第5章构建LAMP网站服务平台

1:安装MYSQL

[root@s1 ~]# useradd -M -s /sbin/nologin mysql
[root@s1 mnt]# tar -zxvf mysql-5.0.56.tar.gz -C /usr/src/
[root@s1 ~]# cd /usr/src/mysql-5.0.56/
[root@s1 mysql-5.0.56]# ./configure --prefix=/usr/local/mysql
[root@s1 mysql-5.0.56]# make && make install
2:建立配置文件
[root@s1 mysql-5.0.56]# cp support-files/my-medium.cnf /etc/my.cnf
3:初始化数据库
[root@s1 mysql-5.0.56]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@s1 mysql-5.0.56]# chown -R root.mysql /usr/local/mysql/
[root@s1 mysql-5.0.56]# chown -R mysql /usr/local/mysql/var/
4:调整lib库路径
[root@s1 mysql-5.0.56]# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
[root@s1 mysql-5.0.56]# ldconfig
5:MYSQL启动控制
[root@s1 mysql-5.0.56]# /usr/local/mysql/bin/mysqld_safe --user=mysql &
[root@s1 mysql-5.0.56]# netstat -ntpl |grep 3306
6:将MYSQL添加为系统服务
[root@s1 mysql-5.0.56]# cp support-files/mysql.server /etc/init.d/mysqld
[root@s1 mysql-5.0.56]# chmod +x /etc/init.d/mysqld
[root@s1 mysql-5.0.56]# chkconfig --add mysqld
[root@s1 mysql-5.0.56]# chkconfig mysqld on
7:设置MYSQL程序的执行路径
[root@s1 mysql-5.0.56]# export PATH=$PATH:/usr/local/mysql/bin/
[root@s1 mysql-5.0.56]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
8:登陆及退出MYSQL环境
[root@s1 ~]# mysql -u root
[root@s1 ~]# mysqladmin -u root password "huang"
[root@s1 ~]# mysql -u root -p
5.2构建PHP环境....................................................................
1:安装PHP软件包
[root@s1 mnt]# tar -jxvf php-5.2.6.tar.bz2 -C /usr/src/
[root@s1 mnt]# cd /usr/src/php-5.2.6/
[root@s1 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
[root@s1 php-5.2.6]# make && make install
[root@s1 php-5.2.6]# cp php.ini-dist /usr/local/php5/php.ini
2:设置HTTP.CONF文件
[root@s1 php-5.2.6]# vi /usr/local/apache2/conf/httpd.conf
 DirectoryIndex index.html index.php
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php
5.3 构架Discuz论坛
[root@s1 ~]# mysql -u root -p
mysql> create database bbsdb;
mysql> grant all on bbsdb.* to identified by 'huang';
mysql> quit
(2)解压缩下载的软件包上传程序文件
[root@s1 mnt]# cp Discuz_6.1.0_SC_UTF8.zip /usr/src/
[root@s1 mnt]# cp UCenter_1.0.0_SC_UTF8.zip /usr/src/
[root@s1 opt]# cd /usr/src/
[root@s1 src]# ls
[root@s1 src]# unzip Discuz_6.1.0_SC_UTF8.zip -d discuz
[root@s1 src]# mv discuz/upload /usr/local/apache2/htdocs/bbs
[root@s1 src]# unzip UCenter_1.0.0_SC_UTF8.zip -d ucenter
[root@s1 src]# mv ucenter/upload /usr/local/apache2/htdocs/ucenter
[root@s1 src]# cd /usr/local/apache2/htdocs/ucenter/
[root@s1 ucenter]# chown -R daemon ./data/
[root@s1 ucenter]# cd /usr/local/apache2/htdocs/bbs/
[root@s1 bbs]# chown -R daemon config.inc.php p_w_uploads/ forumdata/ uc_client
(3)使用及管理Discuz!论坛
[root@s1 bbs]# cd
[root@s1 ~]# cd /usr/local/apache2/htdocs/bbs/
[root@s1 bbs]# mv install install.lock
[root@s1 bbs]# chmod o-rx install.lock/
[root@s1 bbs]# cd /usr/local/apache2/htdocs/ucenter/
[root@s1 ucenter]# mv install install.lock
[root@s1 ucenter]# chmod o-rx install.lock/

 

第六章构建Postfix邮件服务器

1:创建运行postfix服务的用户(postfix) 组(postfix postdrop)
[root@s2 ~]# service iptables stop
[root@s2 ~]# service sendmail stop
Shutting down sm-client: [  OK  ]
Shutting down sendmail: [  OK  ]
[root@s2 ~]# chkconfig --level 35 sendmail off
[root@s2 ~]# groupadd -g 1200 postdrop
[root@s2 ~]# groupadd -g 1000 postfix
[root@s2 ~]# useradd -M -u 1000 -g postfix -G postdrop -s /sbin/nologin postfix
2:解压并释放源码包,合并补丁包
[root@s2 mnt]# tar -zxvf postfix-2.4.6.tar.gz -C /usr/src/
[root@s2 mnt]# cp postfix-2.4.6-vda-ng.patch.gz /usr/src/
[root@s2 mnt]# cd /usr/src/
[root@s2 src]# gunzip postfix-2.4.6-vda-ng.patch.gz
[root@s2 src]# cd postfix-2.4.6
[root@s2 postfix-2.4.6]# patch -p1 < ../postfix-2.4.6-vda-ng.patch
3:预配置编译参数
[root@s2 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@s2 postfix-2.4.6]# make && make install
5:postfix的配置文件
[root@s2 postfix-2.4.6]# cd /etc/postfix/
[root@s2 postfix]# postconf -n > main2.cf
[root@s2 postfix]# mv main.cf main.cf.bak
[root@s2 postfix]# mv main2.cf main.cf
[root@s2 postfix]# cat main.cf
6:Postfix的启动控制
[root@s2 postfix]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@s2 postfix]# netstat -antp |grep :25
7:编辑main.cf文件,调整postfix的基本运行参数
[root@s2 ~]# vi /etc/postfix/main.cf
inet_interfaces = 172.16.16.199, 127.0.0.1
myhostname = mail.benet.com
mydomain = benet.com
myorigin = $mydomain
mydestination = $mydomain, $myhostname
home_mailbox = Maildir/
8:添加邮件用户的账号
[root@s2 ~]# groupadd mailusers
[root@s2 ~]# useradd -g mailusers -s /sbin/nologin xiaoqi
[root@s2 ~]# useradd -g mailusers -s /sbin/nologin lisi
(9):构建Dovecot服务器
9:编译安装Dovecot软件包
[root@s2 ~]# useradd -M -s /sbin/nologin dovecot
[root@s2 mnt]# tar -zxvf dovecot-1.1.4.tar.gz -C /usr/src/
[root@s2 mnt]# cd /usr/src/dovecot-1.1.4/
[root@s2 dovecot-1.1.4]# ./configure --sysconfdir=/etc --with-mysql
[root@s2 dovecot-1.1.4]# make && make install
10:配置Dovecot的运行参数
[root@s2 dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf
[root@s2 dovecot-1.1.4]# vi /etc/dovecot.conf
ssl_disable = yes
protocols = imap pop3
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
[root@s2 ~]# vi /etc/pam.d/dovecot
auth      required           pam_nologin.so
auth      include            system-auth
account   include            system-auth
session   include            system-auth
11:启动Dovecot服务,并验证其监听的TCP端口(110 143)
[root@s2 ~]# /usr/local/sbin/dovecot -c /etc/dovecot.conf
[root@s2 ~]# netstat -nutpl|grep dovecot
(12)Webmail邮箱界面
12:依次安装程序包,中文语言包
[root@s2 mnt]# tar -jxvf squirrelmail-1.4.13.tar.bz2 -C /usr/local/apache2/htdocs/
[root@s2 mnt]# cp zh_CN-1.4.13-20071220.tar.bz2 /usr/local/apache2/htdocs/squirrelmail-1.4.13/
[root@s2 mnt]# cd /usr/local/apache2/htdocs/
[root@s2 htdocs]# mv squirrelmail-1.4.13 webmail
[root@s2 htdocs]# cd webmail/
[root@s2 webmail]# tar -jxvf zh_CN-1.4.13-20071220.tar.bz2
13:创建及调整数据目录,附加目录
[root@s2 webmail]# mkdir -p attach data
[root@s2 webmail]# chown -R daemon:daemon attach/ data/
[root@s2 webmail]# chmod 730 attach/
14:建立config.php配置文件
[root@s2 webmail]# cp config/config_default.php config/config.php
[root@s2 webmail]# vi config/config.php
$squirrelmail_default_language = 'zh_CN';
$default_charset = 'zh_CN.UTF-8';
$domain = 'benet.com';
$smtpServerAddress = 'localhost';
$smtpPort = 25;
$imap_server_type = 'dovecot';
$imapPort = 143;
$data_dir = '/usr/local/apache2/htdocs/webmail/data/';
$p_w_upload_dir = '/usr/local/apache2/htdocs/webmail/attach/';
15:设置CyrusSASL函数库,并启动saslauthd服务
[root@s2 ~]# cp /usr/lib/sasl2/Sendmail.conf /usr/lib/sasl2/smtpd.conf
[root@s2 ~]# vi /usr/lib/sasl2/smtpd.conf
pwcheck_method:saslauthd
[root@s2 ~]# service saslauthd start
[root@s2 ~]# chkconfig --level 35 saslauthd on
16:修改main.cf配置文件,添加SMTP认证相关的参数。并重新加载配置
[root@s2 ~]# vi /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
mynetworks = 172.0.0.1
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, rej
ect_unauth_destination
[root@s2 ~]# postfix reload
17:测试SMTP发信认证
[root@s2 ~]# printf "xiaoqi" | openssl base64
[root@s2 ~]# printf "123" | openssl base64
[root@s2 ~]# telnet mail.benet.com 25
18:设置邮件别名实现群发功能
[root@s2 ~]# vi /etc/aliases
student: zhangsan, lisi, xiaoqi 文件末尾添加
[root@s2 ~]# newaliases
19:限制用户可发送的邮件大小
[root@s2 ~]# vi /etc/postfix/main.cf
message_size_limit = 20971520
[root@s2 ~]# postfix reload

 

第七章构建Postfix邮件服务器

配置ip以便从ftp下载所需软件-------------------------------------------------------------
[root@s2 ~]# ifconfig eth0 172.16.16.154/16   
[root@s2 ~]# ping 172.16.16.1
[root@s2 ~]# ftp 172.16.16.1
  
登陆ftp  user:ftp
         pass:ftp
         cd lyz
         cd soft
         cd LNS
         cd LNS-SG7
         mget *                                                            
         y
         ......
         bye

搭建DNS服务器---------------------------------------------------------------------------

安装BIND软件
[root@s2 extmail]# cd
[root@s2 ~]# mount /dev/cdrom /media/cdrom
[root@s2 ~]# cd /media/cdrom/Server/
[root@s2 Server]# rpm -ivh bind-9.3.3-7.el5.i386.rpm
[root@s2 Server]# rpm -ivh bind-utils-9.3.3-7.el5.i386.rpm
[root@s2 Server]# rpm -ivh bind-chroot-9.3.3-7.el5.i386.rpm
[root@s2 Server]# rpm -ivh caching-nameserver-9.3.3-7.el5.i386.rpm
[root@s2 Server]# cd
建立benet.com域的named.conf配置文件
[root@s2 ~]# vi /var/named/chroot/etc/named.conf

options {

        directory "/var/named";
        };
zone "benet.com" IN {
        type master;
        file "aa";
                };
zone "16.16.172.in-addr.arpa" IN {
        type master;
        file "bb";
                };

建立区域数据库文件并重启named服务

[root@s2 ~]# vi /var/named/chroot/var/named/aa

$TTL    86400

@               IN SOA  benet.com.       root.benet.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

@       IN      NS      mail
mail    IN      A       172.16.16.154
@       IN      MX      5       mail

[root@s2 ~]# service named restart

建立虚拟用户数据库----------------------------------------------------------------------

启动mysql服务,并导入Eetman软件包中的数据库初始化脚本
[root@s2 ~]# service mysqld restart     
[root@s2 ~]# tar zxvf extman-0.2.5.tar.gz    
[root@s2 ~]# cd extman-0.2.5/docs/
[root@s2 docs]# PATH=$PATH:/usr/local/mysql/bin/mysql    
[root@s2 docs]# mysql -u root -p < extmail.sql     
Enter password:benet
[root@s2 docs]# mysql -u root -p < init.sql
Enter password:benet

修改Postfix配置-------------------------------------------------------------------------

修改main.cf配置文件,使Postfix服务器支持读取保存在MysqL数据库中的虚拟用户
[root@s2 docs]# vi /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:1000
 
[root@s2 docs]# cp mysql_virtual_* /etc/postfix
[root@s2 docs]# cd

为虚拟用户设置SMTP发信认证--------------------------------------------------------------

1.编译安装courier-authlib软件包
[root@s2 ~]# tar jxvf courier-authlib-0.60.2.tar.bz2
[root@s2 ~]# cd courier-authlib-0.60.2
[root@s2 courier-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@s2 courier-authlib-0.60.2]# make && make install
[root@s2 courier-authlib-0.60.2]# make install-configure
2.修改courier-authlib相关配置,并启动服务
 a.将courier-authlib的库文件路径添加到系统的搜索路径中
[root@s2 courier-authlib-0.60.2]# vi /etc/ld.so.conf

/usr/local/courier-authlib/lib/courier-authlib

  
[root@s2 courier-authlib-0.60.2]# ldconfig
 b.修改authdaemonrc主配置文件
[root@s2 courier-authlib-0.60.2]# cd /usr/local/courier-authlib/etc/authlib/
[root@s2 authlib]# cp authdaemonrc authdaemonrc.bak 
[root@s2 authlib]# vi authdaemonrc 
  
authmodulelist="authmysql"  
authmodulelistorig="authmysql"  

[root@s2 authlib]# chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon/

 c.修改authmysqlrc文件 
[root@s2 authlib]# cp authmysqlrc authmysqlrc.bak
[root@s2 authlib]# vi authmysqlrc
 
MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail 
MYSQL_SOCKET            /tmp/mysql.sock
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox 
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         uidnumber
MYSQL_GID_FIELD         gidnumber  
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        concat('/mailbox/',homedir)
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     concat('/mailbox/',maildir)

 d.复制courier-authlib脚本,并启动courier-authlib服务

[root@s2 authlib]# cd
[root@s2 ~]# cd courier-authlib-0.60.2
[root@s2 courier-authlib-0.60.2]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib
[root@s2 courier-authlib-0.60.2]# chmod 755 /etc/rc.d/init.d/courier-authlib
[root@s2 courier-authlib-0.60.2]# chkconfig --level 35 courier-authlib on
[root@s2 courier-authlib-0.60.2]# service courier-authlib start
3.修改Cyrus sasl设置
[root@s2 courier-authlib-0.60.2]# vi /usr/lib/sasl2/smtpd.conf

pwcheck_method: authdaemond

authdaemond_path: /usr/local/courier-authlib/var/spool/authdaemon/socket

修改Dovecot的配置-----------------------------------------------------------------------

修改邮件存储位置并设置启用数据库查询功能
[root@s2 courier-authlib-0.60.2]# vi /etc/dovecot.conf

mail_location = maildir:/mailbox/%d/%n/Maildir

......  
auth default {
  mechanisms = plain
  passdb sql {
     args = /etc/dovecot-mysql.conf
  }
  userdb sql {
     args = /etc/dovecot-mysql.conf
  }  
......
}

[root@s2 courier-authlib-0.60.2]# vi /etc/dovecot-mysql.conf   //建立数据查询配置文件

driver = 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'

建立虚拟用户邮箱目录,调整权限,并启动Dovecot服务

[root@s2 courier-authlib-0.60.2]# mkdir -p /mailbox/extmail.org/postmaster/Maildir/
[root@s2 courier-authlib-0.60.2]# cd /mailbox//extmail.org/postmaster/Maildir/
[root@s2 Maildir]# chown -R postfix:postfix /mailbox
[root@s2 Maildir]# dovecot

测试虚拟用户实现结果--------------------------------------------------------------------

测试authlib服务
[root@s2 Maildir]# /usr/local/courier-authlib/sbin/authtest -s login extmail
测试对虚拟用户的SMTP发信认证
[root@s2 Maildir]# perl -e 'use MIME::Base64; print encode_base64("postmaster\@extmail.org")'
[root@s2 Maildir]# perl -e 'use MIME::Base64; print encode_base64("extmail")'

部署ExtMail邮件使用界面-----------------------------------------------------------------

1.按顺序安装三个perl支持软件包
[root@s2 Maildir]# cd
[root@s2 ~]# tar zxvf Unix-Syslog-1.1.tar.gz
[root@s2 ~]# tar zxvf DBI-1.607.tar.gz
[root@s2 ~]# tar zxvf DBD-mysql-4.011.tar.gz
[root@s2 ~]# cd Unix-Syslog-1.1
[root@s2 Unix-Syslog-1.1]# perl Makefile.PL
[root@s2 Unix-Syslog-1.1]# make && make install  
[root@s2 Unix-Syslog-1.1]# cd ../DBI-1.607
[root@s2 DBI-1.607]# perl Makefile.PL
[root@s2 DBI-1.607]# make && make install 
[root@s2 DBI-1.607]# cd ../DBD-mysql-4.011
[root@s2 DBD-mysql-4.011]# perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config  
[root@s2 DBD-mysql-4.011]# make && make install
2.安装并配置ExtMail套件
[root@s2 DBD-mysql-4.011]# cd
[root@s2 ~]# tar zxvf extmail-1.0.5.tar.gz -C /usr/local/apache2/htdocs
[root@s2 ~]# cd /usr/local/apache2/htdocs
[root@s2 htdocs]# mv extmail-1.0.5 extmail
[root@s2 htdocs]# cd extmail
[root@s2 extmail]# chown -R postfix:postfix cgi  //调整cgi子目录的属主属组
[root@s2 extmail]# cp webmail.cf.default webmail.cf
[root@s2 extmail]# vi /usr/local/apache2/htdocs/extmail/webmail.cf

SYS_CONFIG = /usr/local/apache2/htdocs/extmail/

SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html
SYS_MAILDIR_BASE = /mailbox  
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /tmp/mysql.sock

3.调整httpd.conf文件中的配置,并重启httpd服务 

[root@s2 ~]# vi /usr/local/apache2/conf/httpd.conf

ServerName mail.benet.com

NameVirtualHost 172.16.16.154
<VirtualHost 172.16.16.154>
     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@s2 extmail]# /usr/local/apache2/bin/apachectl restart

部署Extman Web管理界面------------------------------------------------------------------

1.安装perl支持软件包GD、File-Tail及rrdtoll绘图引擎工具
[root@s2 ~]# tar zxvf GD-2.41.tar.gz
[root@s2 ~]# tar zxvf File-Tail-0.99.3.tar.gz
[root@s2 ~]# cd GD-2.41
[root@s2 GD-2.41]# perl Makefile.PL
[root@s2 GD-2.41]# make && make install
[root@s2 GD-2.41]# cd ../File-Tail-0.99.3
[root@s2 File-Tail-0.99.3]# perl Makefile.PL
[root@s2 File-Tail-0.99.3]# make && make install
[root@s2 File-Tail-0.99.3]# cd
[root@s2 ~]# rpm -ivh rrdtool-1.2.23-3.el5.i386.rpm
[root@s2 ~]# rpm -ivh rrdtool-perl-1.2.23-3.el5.i386.rpm
2.安装并配置Extman套件
[root@s2 ~]# tar zxvf extman-0.2.5.tar.gz  -C /usr/local/apache2/htdocs/
[root@s2 ~]# cd /usr/local/apache2/htdocs/
[root@s2 htdocs]# mv extman-0.2.5 extman
[root@s2 htdocs]# chown -R postfix:postfix /usr/local/apache2/htdocs/extman/cgi
[root@s2 htdocs]# mkdir /tmp/extman
[root@s2 htdocs]# chown -R postfix:postfix /tmp/extman
[root@s2 htdocs]# vi /usr/local/apache2/htdocs/extman/webman.cf

SYS_CONFIG = /usr/local/apache2/htdocs/extmail/

SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html
SYS_MAILDIR_BASE = /mailbox  
SYS_MYSQL_USER = webman
SYS_MYSQL_PASS = webman
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /tmp/mysql.sock

3.调整httpd.conf文件中的配置,并重启httpd服务

[root@s2 htdocs]# vi /usr/local/apache2/conf/httpd.conf

ServerName mail.benet.com

NameVirtualHost 172.16.16.154
<VirtualHost 172.16.16.154>
     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@s2 htdocs]# /usr/local/apache2/bin/apachectl restart
显示图形日志时需要作如下配置
[root@s2 apache2]# mkdir /usr/local/mailgraph_ext
[root@s2 apache2]# find / -name mailgrap_ext.pl

[root@s2 apache2]# find / -name mailgraph_ext.pl

/usr/local/apache2/htdocs/extman/addon/mailgraph_ext/mailgraph_ext.pl
/usr/src/extman-0.2.5/addon/mailgraph_ext/mailgraph_ext.pl
[root@s2 apache2]# cp /usr/src/extman-0.2.5/addon/mailgraph_ext/mailgraph_ext.pl /usr/local/mailgraph_ext/
[root@s2 apache2]# mailgraph-init start
[root@s2 apache2]# find / -name qmonitor.pl
/usr/local/apache2/htdocs/extman/addon/mailgraph_ext/qmonitor.pl
/usr/src/extman-0.2.5/addon/mailgraph_ext/qmonitor.pl
[root@s2 apache2]# cp
[root@s2 apache2]# cp /usr/src/extman-0.2.5/addon/mailgraph_ext/qmonitor.pl /usr/local/mailgraph_ext/qmonitor.pl
[root@s2 apache2]# qmonitor-init start
Starting queue statistics grapher: qmonitor
[root@s2 apache2]# echo "/usr/sbin/mailgraph-init start" >> /etc/rc.d/rc.local
[root@s2 apache2]# echo "/usr/sbin/qmonitor-init start" >> /etc/rc.d/rc.local
注意:用wendows验证时Linux系统时间需和wendows一致,否则提示验证码不正确

显示图形日志时需要作如下配置------------------------------------------------------------

[root@s2 htdocs]# cd  /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/
[root@s2 mailgraph_ext]# mkdir /usr/local/mailgraph_ext/
[root@s2 mailgraph_ext]# cp mailgraph_ext.pl  qmonitor.pl /usr/local/mailgraph_ext/
[root@s2 mailgraph_ext]# ./mailgraph-init start
[root@s2 mailgraph_ext]# ./qmonitor-init start