前言:
本人之前已经做过这个实验,只是版本不同,今天本来想用全新版本的源码包做实验,但是以httpd-2.4.2.tar.gz的源码包在配置虚拟主机这一块我不知道如何配置,按照以前的配置总是报错:AH00548: NameVirtualHost has no effect and will be removed in the next release /usr/local/apache2/conf/httpd.conf:491,在此纠结了很久,最终未果,就换了httpd-2.2.9的源码包做的实验,一路下来偶尔出点小插曲,但差不多都解决了,但是在登录webmail界面的时候我的图片不能正常显示,检查了配置文件,仍然没有解决,请大家多多指教一下,下面是我在虚拟机上的配置过程:
先把我实验的包大概说一下:
下面是实验过程
[root@mail ~]# uname -a //检查系统环境
Linux mail 2.6.18-238.el5 #1 SMP Sun Dec 19 14:24:47 EST 2010 i686 i686 i386 GNU/Linux
[root@mail ~]#
[root@mail ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain
192.168.10.170 mail.chenkui.com //添加主机解析记录
::1 localhost6.localdomain6 localhost6
[root@mail ~]#
[root@mail ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=mail 修改主机名
GATEWAY=192.168.10.1
[root@mail ~]# init 6 //在此修改主机名要重启才能生效
构建本地DVD yum源
安装createrepo软件包//在系统光盘中自带有此软件包
手动挂载光驱:mount /dev/cdrom /mnt Or /dev/dhc /mnt 这个时候,进入/mnt就可以看到光盘上的文件了
[root@mail ~]# rpm -ivh /mnt/Server/createrepo-0.4.11-3.el5.noarch.rpm
warning: /mnt/Server/createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[root@mail ~]#
然后修改/etc/yum.repos.d/rhel-debuginfo.repo,把里面的内容修改成如下:
[root@mail mnt]# vi /etc/yum.repos.d/rhel-debuginfo.repo
[Cluster]
enabled = 1 //1表示repo中定义的源是启用的,0为禁用
name = Cluster //目录名称可自定义,在此我就把它定义为光盘中软件的目录名称
baseurl = file:///mnt/Cluster //把光盘挂载在哪个目录下面,此处就定义哪个目录
gpgcheck = 0 //表示这个repo中下载的rpm将进行gpg的校验,已确定rpm包的来源是有效和安全的,一般在此不启用
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release//定义用于校验的gpg密钥,当不启用的时候可以不定义该
url
[Server]
enabled = 1
name = Server
baseurl = file:///mnt/Server
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[ClusterStorage]
enabled = 1
name = ClusterStorage
baseurl = file:///mnt/ClusterStorage
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[VT]
enabled = 1
name = VT
baseurl = file:///mnt/VT
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
保存退出
构建DNS域名服务
有了以上的yum本地源,可以直接使用yum安装相关包
[root@mail ~] yum install bind-* -y //-y表示默认确定安装,不加-y后面会有交互式的提示
安装缓存包,用于创建 named.conf 主配置文件
[root@mail ~] cd /var/named/chroot/etc/
[root@mail etc]# rpm -ivh /mnt/Server/caching-nameserver-9.3.6-16.P1.el5.i386.rpm
Preparing... ########################################### [100%]
1:caching-nameserver ########################################### [100%]
[root@mail etc]# ll
总计 16
-rw-r--r-- 1 root root 405 05-10 21:03 localtime
-rw-r----- 1 root named 1230 2010-12-03 named.caching-nameserver.conf
-rw-r----- 1 root named 955 2010-12-03 named.rfc1912.zones
-rw-r----- 1 root named 113 05-15 15:50 rndc.key
[root@mail etc]# cp -p named.caching-nameserver.conf named.conf //-p表示复制文件的属性
[root@mail etc]# vi named.conf
options {
directory "/var/named";
};
zone "chenkui.com" IN {
type master;
file "chenkui.zone";
};
zone "10.168.192.in-addr.arpa" in {
type master;
file "chenkui.zero";
};
[root@mail etc]# named-checkconf named.conf //检查配置文件有没有语法错误,如果没有任何输出结果表示没有错误
[root@mail etc]# //在此没有输出结果
[root@mail etc]# cd ../var/named/
[root@mail named]# ll
总计 36
drwxrwx--- 2 named named 4096 2004-08-26 data
-rw-r----- 1 root named 198 2010-12-03 localdomain.zone
-rw-r----- 1 root named 195 2010-12-03 localhost.zone
-rw-r----- 1 root named 427 2010-12-03 named.broadcast
-rw-r----- 1 root named 1892 2010-12-03 named.ca
-rw-r----- 1 root named 424 2010-12-03 named.ip6.local
-rw-r----- 1 root named 426 2010-12-03 named.local
-rw-r----- 1 root named 427 2010-12-03 named.zero
drwxrwx--- 2 named named 4096 2004-07-27 slaves
[root@mail named]# cp -p localhost.zone chenkui.zone //创建区域数据库文件
[root@mail named]# vi chenkui.zone
$TTL 86400
@ IN SOA chenkui.com. root.chenkui.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS www.chenkui.com.
www IN A 192.168.10.170
mail IN A 192.168.10.170
IN MX 10 mail.chenkui.com.
* IN A 192.168.10.170
pop3 IN CNAME mail
smtp IN CNAME mail
:wq //保存退出
[root@mail named]# cp -p chenkui.zone chenkui.zero //创建反向解析文件
[root@mail named]# vi chenkui.zero
$TTL 86400
@ IN SOA chenkui.com. root.chenkui.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS www.chenkui.com.
170 IN PTR www.chenkui.com.
170 IN PTR mail.chenkui.com.
:wq //保存退出
[root@mail ~]# cd /var/named/chroot/var/named/
[root@mail ~]# named-checkzone chenkui.com chenkui.zone
zone chenkui.com/IN: loaded serial 42
OK
[root@mail named]# // named-checkzone通过检查句法的正确性来检查区带(zone)文件的正确性。named-checkzone如果没有检查到错误,会返回一个简单的“OK”字
符。
[root@mail ~]# vi /etc/resolv.conf
nameserver 192.168.10.170 //修改DNS指向自己
[root@mail etc]# nslookup 192.168.10.170 //验证反向解析
Server: 192.168.10.170
Address: 192.168.10.170#53
170.10.168.192.in-addr.arpa name = www.chenkui.com.
170.10.168.192.in-addr.arpa name = mail.chenkui.com.
[root@mail etc]# nslookup mail.chenkui.com
Server: 192.168.10.170
Address: 192.168.10.170#53
Name: mail.chenkui.com
Address: 192.168.10.170
[root@mail etc]#
[root@mail etc]# chkconfig named on //添加为随系统启动
[root@mail etc]# chkconfig --add named //添加到系统服务列表
[root@mail etc]# rndc reload
server reload successful
构建LAMP平台
在此我使用的是httpd-2.2.9的源码包,安装之前需要安装apr-1.4.6.tar.gz、apr-util-1.4.1.tar.gz、pcre-8.30.zip等软件包支持http
[root@mail etc]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail etc]# cd /mnt
[root@mail mnt]# ll
总计 64272
-r-xr-xr-x 1 root root 982243 04-29 11:49 apr-1.4.6.tar.gz
-r-xr-xr-x 1 root root 774770 04-29 11:50 apr-util-1.4.1.tar.gz
-r-xr-xr-x 1 root root 5583905 04-29 15:23 cmake-2.8.6.tar.gz
-r-xr-xr-x 1 root root 5616185 04-29 11:02 httpd-2.4.2.tar.gz
-r-xr-xr-x 1 root root 875425 05-09 14:59 libmcrypt-2.5.8.tar.bz2
-r-xr-xr-x 1 root root 471915 05-09 15:10 mcrypt-2.6.8.tar.gz
-r-xr-xr-x 1 root root 655906 05-09 15:08 mhash-0.9.9.9.tar.bz2
-r-xr-xr-x 1 root root 24475686 05-25 11:43 mysql-5.5.22.tar.gz
-r-xr-xr-x 1 root root 1285776 04-29 12:37 pcre-8.10.tar.gz
-r-xr-xr-x 1 root root 1409751 04-29 12:34 pcre-8.10.zip
-r-xr-xr-x 1 root root 11707402 04-29 18:44 php-5.3.10.tar.bz2
-r-xr-xr-x 1 root root 11439508 05-09 14:30 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 531360 05-22 21:00 squirrelmail-webmail-1.4.22.tar.bz2
[root@mail mnt]# tar zxvf apr-1.4.6.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/apr-1.4.6/
[root@mail apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@mail apr-1.4.6]# make && make install
2、
[root@mail mnt]# tar -zxvf apr-util-1.4.1.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/apr-util-1.4.1/
[root@mail apr-util-1.4.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@mail apr-util-1.4.1]# make && make install
3、
unzip pcre-8.30.zip -d /usr/src
cd /usr/src/pcre-8.30
./configure --prefix=/usr/local/pcre
make && make install
uzip解压参数
-x 文件列表 解压缩文件,但不包括指定的file文件。
-v 查看压缩文件目录,但不解压。
-t 测试文件有无损坏,但不解压。
-d 目录 把压缩文件解到指定目录下。
-z 只显示压缩文件的注解。
-n 不覆盖已经存在的文件。
-o 覆盖已存在的文件且不要求用户确认。
-j 不重建文档的目录结构,把所有文件解压到同一目录下。
4、
[root@mail mnt]# tar -zxvf httpd-2.2.9.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/httpd-2.2.9
[root@mail httpd-2.2.9]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
[root@mail httpd-2.2.9]# make && make install
[root@mail httpd-2.2.9]# vi /usr/local/apache2/conf/httpd.conf
ServerName mail.chenkui.com
[root@mail httpd-2.2.9]# vi /etc/profile
56 PATH=$PATH:/usr/local/apache2/bin/
[root@mail httpd-2.2.9]# . /etc/profile //重新载入环境变量
[root@mail apache2]# echo $PATH //此时已经有apache的变量路径存在
/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/apache2/bin/
[root@mail apache2]# apachectl -t
Syntax OK
[root@mail apache2]# vi /etc/ld.so.conf/
/usr/local/apache2/lib/ //添加apache的库文件搜索路径
[root@mail apache2]# ldconfig //重新加载库文件搜索路径
[root@mail apache2]# apachectl start
httpd (pid 21702) already running
[root@mail apache2]# netstat -nplt | grep httpd
tcp 0 0 :::80 :::* LISTEN 21702/httpd
[root@mail apache2]#
安装Mysql5.5.22
现在的5.5版本以上的MySQL都使用Cmake进行编译安装,所以在安装MySQL之前我们首先要把Cmake装在我们的系统。
我们所需要的软件源码包有以下:
cmake-2.8.6.tar.gz
mysql-5.5.22.tar.gz
1、安装Cmake
#安装所需依赖关系
yum -y install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel
freetype-devel libXpm-devel gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel
libmcrypt libmcrypt-devel mcrypt libmhash libmhash-devel
[root@mail mnt]# tar -jxvf libmcrypt-2.5.8.tar.bz2 -C /usr/src/
[root@mail libmcrypt-2.5.8]# ./configure
[root@mail libmcrypt-2.5.8]# make && make install
[root@mail mnt]# tar -zxvf mhash-0.9.9.tar.gz -C /usr/src
[root@mail mnt]# cd /usr/src/
[root@mail mhash-0.9.9]# ./configure
[root@mail mhash-0.9.9]# make && make install
[root@mail mnt]# tar -zxvf mcrypt-2.6.8.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/mcrypt-2.6.8/
[root@mail mcrypt-2.6.8]# ln -s /usr/local/libmcrypt/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@mail mcrypt-2.6.8]# ln -s /usr/local/libmcrypt/lib/libmcrypt.so /usr/lib/libmcrypt.so
libmcheck.a libmcop_mt.la libmcop_mt.so.1 libmcop.so libmcop.so.1.0.0
libmcop.la libmcop_mt.so libmcop_mt.so.1.0.0 libmcop.so.1 libmcrypt.la
[root@mail mcrypt-2.6.8]# ln -s /usr/local/libmcrypt/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@mail mcrypt-2.6.8]# ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@mail mcrypt-2.6.8]# ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@mail mcrypt-2.6.8]#
[root@mail mcrypt-2.6.8]# export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
[root@mail mcrypt-2.6.8]# ./configure
[root@mail mcrypt-2.6.8]# make && make install
安装cmake
[root@mail mnt]# tar zxvf cmake-2.8.6.tar.gz -C /usr/src
[root@mail mnt]# cd /usr/src/cmake-2.8.6/
[root@mail mnt]# ./configure && make && make install
2、编译安装配置MySQL
创建所需目录mkdir -pv /usr/local/mysql/data //同时创建mysql和data两个目录并输出创建信息
创建mysql组 groupadd mysql
创建mysql用户 useradd -M -g ysql -s /sbin/nologin mysql //创建mysql用户并加入mysql组,并不能登录到系统
解压源码
[root@mail mnt]# tar -zxvf mysql-5.5.22.tar.gz -C /usr/src/ /本人一般解压在此目录下面
[root@mail mnt]# cd /usr/src/mysql-5.5.22
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8-
DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -
DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_DEBUG=0
参数说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录
-DMYSQL_DATADIR=/usr/local/mysql/data //数据库存放目录
-DWITH_MYISAM_STORAGE_ENGINE=1 //安装myisam存储引擎
-DWITH_INNOBASE_STORAGE_ENGINE=1 //安装innodb存储引擎
-DWITH_ARCHIVE_STORAGE_ENGINE=1 //安装archive存储引擎
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 //安装blackhole存储引擎
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DMYSQL_TCP_PORT=3306 //MySQL监听端口
-DMYSQL_USER=mysql //MySQL用户名
其他参数:
-DWITH-EMBEDDED_SERVER=1 //编译成embedded MySQL library (libmysqld.a)
-DSYSCONFDIR=/etc //MySQL配辑文件
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock //Unix socket 文件路径
-DWITH_READLINE=1 //快捷键功能
-DWITH_SSL=yes //SSL
-DWITH_MEMORY_STORAGE_ENGINE=1 //安装memory存储引擎
-DWITH_FEDERATED_STORAGE_ENGINE=1 //安装frderated存储引擎
-DWITH_PARTITION_STORAGE_ENGINE=1 //安装数据库分区
-DINSTALL_PLUGINDIR=/usr/local/mysql/plugin //插件文件及配置路径
[root@mail mysql-5.5.22]# make && make install
#复制配置文件
[root@mail mysql-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf
#设置权限
[root@mail mysql-5.5.22]# chmod +x /usr/local/mysql/
[root@mail mysql-5.5.22]# chown -R mysql.mysql /usr/local/mysql/
[root@mail mysql-5.5.22]# chown -R mysql.mysql /usr/local/mysql/data/
[root@mail mysql-5.5.22]#
#配置开机自动启动
[root@mail mysql-5.5.22]# cp support-files/mysql.server /etc/init.d/mysqld
[root@mail mysql-5.5.22]# chmod +x /etc/rc.d/init.d/mysqld
[root@mail mysql-5.5.22]# chkconfig mysqld on
[root@mail mysql-5.5.22]# chkconfig --add mysqld
[root@mail mysql-5.5.22]#
#修改配置文件
vim /etc/my.cnf
#在[mysqld]中添加:
datadir = /usr/local/mysql/data
log-error = /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mail.pid //(此处的pid文件名称要与主机名称一致)
user = mysql
tmpdir = /tmp
#保存退出
初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
手动启动MySQL
service mysqld start //第一次我在这里启动失败,查看日志,提示字符集无效,修改my.cnf配置文件,添加下面设置,后来就没的错误了
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
保存退出后重新初始化数据库
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
测试MySQL是否启动
[root@mail mysql-5.5.22]# service mysqld restart
MySQL server PID file could not be found! [失败]
Starting MySQL..... [确定]
[root@mail mysql-5.5.22]# netstat -nuptl | grep 3306
tcp 0 0 :::3306 :::* LISTEN 3430/mysqld
[root@mail mysql-5.5.22]# export PATH=$PATH:/usr/local/mysql/bin
[root@mail mysql-5.5.22]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@mail mysql-5.5.22]# echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
[root@mail mysql-5.5.22]# mysqladmin version
mysqladmin Ver 8.42 Distrib 5.5.22, for Linux on i686
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Server version 5.5.22-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 2 min 11 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.007
[root@mail mysql-5.5.22]#
到此MySQL编译安装完成
第一次登录默认为空密码
mysql -u root //以管理员身份登录mysql数据库
修改root登录数据库的密码
mysqladmin -u root password "自定义的密码"
安装PHP
[root@mail php-5.3.10]# tar -jxvf php-5.3.10.tar.bz2 -C /usr/src
[root@mail php-5.3.10]# cd /usr/src/php-5.3.10
[root@mail php-5.3.10]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --
enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-apxs2=/usr/local/apache2/bin/apxs
--with-mcrypt
[root@mail php-5.3.10]# make && make install
为php提供配置文件:
[root@mail php-5.3.10]# cp php.ini-production /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf,以apache支持php
[root@mail php-5.3.10]# vim /usr/local/apache2/htdocs/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
#确认的存php5_module存在,如果没有就重新编译php
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
至此LAMP搭建成功:
可在APACHE文档目录下面添加下面测试页
vim /index.php
<?php
phpinfo();
?>
在浏览器中输入网站网址,如果出现php的版本信息页面说明php与apahce整合成功
安装Postfix // 这里我交所有软件打包成一个postfix.iso的文件,放入光驱中
确定系统里没有安装Sendmail,安装了卸载。
[root@mail ~]# rpm -qa sendmail
sendmail-8.13.8-8.el5
[root@mail ~]# rpm -e --nodeps sendmail
[root@mail ~]# rpm -qa sendmail
[root@mail ~]#
[root@mail ~]# groupadd -g 1200 postdrop
[root@mail ~]# groupadd -g 1000 postfix
[root@mail ~]# useradd -M -u 1000 -g postfix -G postdrop -s /sbin/nologin postfix
[root@mail ~]# yum -y install mysql-devel-* //挂载系统光盘安装安装mysql-devel-*,否则在后面会提示找不到mysql.h
[root@mail ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail ~]# cd /mnt
[root@mail mnt]# ll
[root@mail mnt]# tar -zxvf postfix-2.8.2.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/postfix-2.8.2/
[root@mail postfix-2.8.2]# cp /usr/local/mysql/lib/* /usr/lib/ //复制Mysql的库文件,否则后面安装Postfix提示库文件找不到
[root@mail postfix-2.8.2]# make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -I/usr/local/include/sasl'
'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2'
[root@mail postfix-2.8.2]#
[root@mail postfix-2.8.2]# make
[root@mail postfix-2.8.2]# make install
[root@mail postfix-2.8.2]# newaliases // 生成别名二进制文件,这个步骤如果忽略,会造成postfix效率极低
[root@mail postfix-2.8.2]# postconf -a //有Dovecot说明支持Dovecot验证
dovecot
[root@mail postfix-2.8.2]# postconf -m
btree
cidr
environ
hash
internal
mysql //有Mysql说明支持Mysql验证
nis
pcre
proxy
regexp
static
tcp
texthash
unix
[root@mail postfix-2.8.2]#
[root@mail postfix-2.8.2]#
[root@mail postfix-2.8.2]# cp /etc/postfix/main.cf /etc/postfix/main.cf.bak //将配置文件做一个备份
[root@mail postfix-2.8.2]# vim /etc/postfix/main.cf
76 myhostname = mail.chenkui.com
83 mydomain = chenkui.com
99 myorigin = $mydomain
113 inet_interfaces = all
162 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain
259 mynetworks = 192.168.10.0/24, 127.0.0.0/8
[root@mail postfix-2.8.2]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@mail postfix-2.8.2]# postfix check
[root@mail postfix-2.8.2]# service postfix restart //此时提示postfix: 未被识别的服务,那么下面我们来制作postfix的启动文件
[root@mail postfix-2.8.2]# mkdir /tmp/postfix
[root@mail postfix-2.8.2]# cd /tmp/postfix/
[root@mail postfix]# umount /mnt
[root@mail postfix]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail postfix]# cp /mnt/Server/postfix-2.3.3-2.1.el5_2.i386.rpm ./
[root@mail postfix]#
[root@mail postfix]# ll
总计 3652
-r--r--r-- 1 root root 3734257 05-27 20:46 postfix-2.3.3-2.1.el5_2.i386.rpm
[root@mail postfix]#
[root@mail postfix]# rpm2cpio postfix-2.3.3-2.1.el5_2.i386.rpm |cpio -id
16333 blocks
[root@mail postfix]# ll
总计 3664
drwxr-xr-x 5 root root 4096 05-27 20:47 etc
-r--r--r-- 1 root root 3734257 05-27 20:46 postfix-2.3.3-2.1.el5_2.i386.rpm
drwxr-xr-x 7 root root 4096 05-27 20:47 usr
drwxr-xr-x 3 root root 4096 05-27 20:47 var
[root@mail postfix]# ll etc/rc.d/init.d/
总计 4
-rwxr-xr-x 1 root root 2404 05-27 20:47 postfix
[root@mail postfix]# cp etc/rc.d/init.d/postfix /etc/rc.d/init.d/
[root@mail postfix]# service postfix restart
关闭 postfix: [确定]
启动 postfix: [确定]
[root@mail postfix]#
[root@mail postfix]# chkconfig --add postfix
[root@mail postfix]# chkconfig postfix on
[root@mail postfix]# chkconfig --list postfix
postfix 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@mail postfix]#
[root@mail postfix]# useradd user1 //增加两个用户用于后面测试
[root@mail postfix]# useradd user2
[root@mail postfix]# echo "123456" |passwd --stdin user1 //给user1赋值初始密码
Changing password for user user1.
passwd: all authentication tokens updated successfully.
[root@mail postfix]# echo "123456" |passwd --stdin user2
Changing password for user user2.
passwd: all authentication tokens updated successfully.
[root@mail postfix]#
[root@mail postfix]# service mysqld restart
Shutting down MySQL. [确定]
Starting MySQL.. [确定]
[root@mail postfix]# service named restart
停止 named: [确定]
启动 named: [确定]
[root@mail postfix]# //下面来进行telnet smtp的25号端口进行测试能否进行发送邮件
[root@mail postfix]# telnet mail.chenkui.com 25
Trying 192.168.10.170...
Connected to mail.chenkui.com (192.168.10.170).
Escape character is '^]'.
220 mail.chenkui.com ESMTP Postfix
ehlo mail.chenkui.com
250-mail.chenkui.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:user1@chenkui.com //从user1发往到user2,这个过程测试成功说明可以正常发送邮件。
250 2.1.0 Ok
rcpt to:user2@chenkui.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
this is a test E-mail,user1 to user2
.
250 2.0.0 Ok: queued as 80546275AA5
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@mail postfix]#
[root@mail postfix]#/检查user2是否收到
[root@mail postfix]# su - user2
[user2@mail ~]$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/user2": 1 message 1 new
>N 1 user1@chenkui.com Sun May 27 20:59 13/500 //这里user2收到一封来自user1的邮件,序号为1
& 1
Message 1:
From user1@chenkui.com Sun May 27 20:59:38 2012
X-Original-To: user2@chenkui.com
Delivered-To: user2@chenkui.com
Date: Sun, 27 May 2012 20:58:04 +0800 (CST)
From: user1@chenkui.com
this is a test E-mail,user1 to user2 //刚才测试的内容
& quit
Saved 1 message in mbox
[user2@mail ~]$
[user2@mail ~]$ su - root /切换回root用户,在此处一定要加上 - 否则root的shell环境不一样。
口令:
[root@mail ~]#
上面我们只是安装了smtp发送服务器,下面我们来安装接收服务器,并使用dovecot软件。
[root@mail ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@mail ~]# cd /mnt
[root@mail mnt]# groupadd dovecot //建立dovecot组
[root@mail mnt]# useradd -M -g dovecot -s /sbin/nologin dovecot //建立dovecot用户并加入dovecot组,并不允许登录到系统
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# tar -zxvf dovecot-1.1.4.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/dovecot-1.1.4/
[root@mail dovecot-1.1.4]# ./configure --sysconfdir=/etc --with-mysql
[root@mail dovecot-1.1.4]# make && make install
[root@mail dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf //建立主配置文件
[root@mail dovecot-1.1.4]# vi /etc/dovecot.conf
23 protocols = pop3 imap
47 disable_plaintext_auth = no
87 ssl_disable = yes
208 mail_location = maildir:~/Maildir
[root@www dovecot-1.1.4]# vim /etc/postfix/main.cf
414 home_mailbox = Maildir/
建立认证文件
vim /etc/pam.d/dovecot
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
将此脚本加入到开机时自动启动
[root@mail dovecot-1.1.4]# /usr/local/sbin/dovecot -c /etc/dovecot.conf
测试dovecot
[root@mail dovecot-1.1.4]#
[root@mail dovecot-1.1.4]# telnet mail.chenkui.com 110
Trying 192.168.10.170...
Connected to mail.chenkui.com (192.168.10.170).
Escape character is '^]'.
+OK Dovecot ready.
user user2
+OK
pass 123456
+OK Logged in.
list
+OK 0 messages:
.
quit
+OK Logging out.
Connection closed by foreign host.
[root@mail dovecot-1.1.4]#
安装squirrelmail-webmail
[root@mail mnt]# tar -zxvf squirrelmail-webmail-1.4.22.tar.gz -C /usr/local/apache2/htdocs/
[root@mail mnt]# cd /usr/local/apache2/htdocs/
[root@mail htdocs]# ll
总计 12
-rw-r--r-- 1 root root 45 2007-06-12 index.html
-rw-r--r-- 1 root root 20 05-26 21:58 index.php
drwxr-xr-x 16 root root 4096 2011-07-13 squirrelmail-webmail-1.4.22
[root@mail htdocs]# mv squirrelmail-webmail-1.4.22/ webmail
[root@mail htdocs]#
[root@mail htdocs]# cd webmail/
[root@mail webmail]# mkdir -pv data/ attach/
mkdir: 已创建目录 “attach”
[root@mail webmail]# ll
总计 72
drwxr-xr-x 2 root root 4096 05-27 21:36 attach
drwxr-xr-x 5 root root 4096 2011-07-13 class
drwxrwxr-x 2 root root 4096 2011-07-13 config
-rwxr-xr-x 1 root root 102 2005-08-03 configure
drwxr-xr-x 3 root root 4096 2011-07-13 contrib
drwxrwxr-x 2 root root 4096 2011-07-13 data
drwxr-xr-x 3 root root 4096 2011-07-13 doc
drwxr-xr-x 4 root root 4096 2011-07-13 functions
drwxr-xr-x 3 root root 4096 2011-07-13 help
drwxr-xr-x 2 root root 4096 2011-07-13 p_w_picpaths
drwxr-xr-x 3 root root 4096 2011-07-13 include
-rw-r--r-- 1 root root 671 2011-01-06 index.php
drwxr-xr-x 2 root root 4096 2011-07-13 locale
drwxr-xr-x 19 root root 4096 2011-07-13 plugins
drwxr-xr-x 2 root root 4096 2011-07-13 po
-rw-r--r-- 1 root root 56 2009-03-27 README
drwxr-xr-x 2 root root 4096 2011-07-13 src
drwxr-xr-x 3 root root 4096 2011-07-13 themes
[root@mail webmail]#
[root@mail webmail]# chown -R daemon.daemon attach/ data/
[root@mail webmail]#
[root@mail webmail]# chmod 730 attach/
[root@mail webmail]# cp config/config_default.php config/config.php
[root@mail webmail]# vi config/config.php
118 $domain = 'chenkui.com';
146 $smtpServerAddress = 'localhost';
151 $smtpPort = 25;
210 $imapPort = 143;
231 $imap_server_type = 'dovecot';
499 $data_dir = '/usr/local/apache2/htdocs/webmail/data/';
517 $p_w_upload_dir = '/usr/local/apache2/htdocs/webmail/attach/';
[root@mail webmail]# /usr/local/apache2/bin/apachectl restart //重启apache服务
打开浏览器输入:http://mail.chenkui.com/webmail/src/login.php此时可以打开squirrelMail的首页
安装Extman
[root@mail mnt]# tar -zxvf extman-1.1.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/extman-1.1/docs/
[root@mail docs]# ll
总计 76
-rw-r--r-- 1 test test 1250 2006-04-23 backport
-rw-r--r-- 1 test test 11180 2007-02-28 extmail.schema
-rw-r--r-- 1 test test 5141 2008-03-30 extmail.sql
-rw-r--r-- 1 test test 2671 2008-03-19 init.ldif
-rw-r--r-- 1 test test 1478 2008-04-04 init.sql
-rw-r--r-- 1 test test 201 2006-04-24 ldap_virtual_alias_maps.cf
-rw-r--r-- 1 test test 210 2005-12-15 ldap_virtual_domains_maps.cf
-rw-r--r-- 1 test test 195 2005-12-15 ldap_virtual_limit_maps.cf
-rw-r--r-- 1 test test 202 2005-11-04 ldap_virtual_mailbox_maps.cf
-rw-r--r-- 1 test test 190 2007-03-07 ldap_virtual_sender_maps.cf
-rw-r--r-- 1 test test 166 2005-12-15 mysql_virtual_alias_maps.cf
-rw-r--r-- 1 test test 168 2007-02-25 mysql_virtual_domains_maps.cf
-rw-r--r-- 1 test test 170 2005-12-15 mysql_virtual_limit_maps.cf
-rw-r--r-- 1 test test 172 2005-12-15 mysql_virtual_mailbox_maps.cf
-rw-r--r-- 1 test test 173 2007-03-07 mysql_virtual_sender_maps.cf
-rw-r--r-- 1 test test 1337 2005-12-16 README.postfix
[root@mail docs]# vi extmail.sql
查找/替换,将数据库文件内的所有TYPE=MyISAM修改为ENGINE=MyISAM,保存退出;//:%s/TYPE/ENGINE 使用此替换
[root@mail docs]# mysql -u root -p < extmail.sql
Enter password: //默认密码是空的,如果修改过使用修改的密码
[root@mail docs]# mysql -u root -p < init.sql
Enter password:
[root@mail docs]#
配置Postfix
[root@mail ~]# vi /etc/postfix/main.cf //并添加651-656这几行
162 #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, mail.$mydomain, www.$mydomain, ftp.$mydomain //注释掉该行
651 virtual_mailbox_base = /mailbox
652 virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
653 virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
654 virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
655 virtual_uid_maps = static:1000
656 virtual_gid_maps = static:1000
[root@mail ~]# cd /usr/src/extman-1.1/docs/
[root@mail docs]# cp mysql_virtual_* /etc/postfix/
[root@mail docs]#
虚拟用户设置SMTP发信认证
[root@mail mnt]# tar -jxvf courier-authlib-0.62.4.tar.bz2 -C /usr/src/
[root@mail mnt]# cd /usr/src/courier-authlib-0.62.4
[root@mail courier-authlib-0.62.4]# vi /etc/ld.so.conf
ldconfig: /usr/lnflibmysqlclient.so.18 is not a symbolic link
[root@mail courier-authlib-0.62.4]# ln -sf /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
[root@mail courier-authlib-0.62.4]# ./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --with-authmysql --with-redhat --with-mysql-
libs=/usr/local/mysql/lib/ --with-mysql-includes=/usr/local/mysql/include/mysql // 在此也要注意mysql的链接库路径
[root@mail courier-authlib-0.62.4]# make && make install && make install-configure//最后一个参数是表示生成默认配置文件authmysqlrc 和 authdaemonrc
[root@mail courier-authlib-0.62.4]# vi /etc/ld.so.conf
/usr/local/courier-authlib/lib/courier-authlib //添加库文件搜索路径
[root@mail courier-authlib-0.62.4]# ldconfig //重新加载库文件
[root@mail courier-authlib-0.62.4]# cd /usr/local/courier-authlib/etc/authlib/
[root@mail authlib]# ll
总计 56
-rw-rw---- 1 daemon daemon 3704 05-27 22:38 authdaemonrc
-rw-rw---- 1 daemon daemon 3704 05-27 22:38 authdaemonrc.dist
-rw-rw---- 1 daemon daemon 8229 05-27 22:38 authldaprc
-rw-rw---- 1 daemon daemon 8229 05-27 22:38 authldaprc.dist
-rw-rw---- 1 daemon daemon 8812 05-27 22:38 authmysqlrc
-rw-rw---- 1 daemon daemon 8812 05-27 22:38 authmysqlrc.dist
[root@mail authlib]#
[root@mail authlib]# cp authdaemonrc authdaemonrc.bak //做一个备份
[root@mail authlib]# cp authmysqlrc authmysqlrc.bak
[root@mail authlib]#
[root@mail authlib]# vi authdaemonrc
修改
27 authmodulelist="authmysql"
34 authmodulelistorig="authmysql"
75 DEBUG_LOGIN=2 //设置登录记录调试,输出错误日志记录
:wq
[root@mail authlib]# chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon/
[root@mail authlib]# vi authmysqlrc
26 MYSQL_SERVER localhost
27 MYSQL_USERNAME extmail
28 MYSQL_PASSWORD extmail
49 MYSQL_SOCKET /var/lib/mysql/mysql.sock
56 MYSQL_PORT 3306
68 MYSQL_DATABASE extmail
83 MYSQL_USER_TABLE mailbox
92 MYSQL_CRYPT_PWFIELD password
113 MYSQL_UID_FIELD uidnumber
119 MYSQL_GID_FIELD gidnumbe
128 MYSQL_LOGIN_FIELD username
133 MYSQL_HOME_FIELD concat('/mailbox',homedir)
139 MYSQL_NAME_FIELD name
150 MYSQL_MAILDIR_FIELD concat('/mailbox',maildir)
[root@mail authlib]# cd /usr/src/courier-authlib-0.62.4/
[root@mail courier-authlib-0.62.4]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib//复制为系统启动文件
[root@mail courier-authlib-0.62.4]# chmod 755 /etc/init.d/courier-authlib
[root@mail courier-authlib-0.62.4]# chkconfig --add courier-authlib
[root@mail courier-authlib-0.62.4]# chkconfig --level 2345 courier-authlib on
[root@mail courier-authlib-0.62.4]# chkconfig --list courier-authlib
courier-authlib 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@mail ~]# service courier-authlib start
Starting Courier authentication services: authdaemond
[root@mail ~]# cd /usr/src/courier-authlib-0.62.4
[root@mail courier-authlib-0.62.4]# cp /tmp/postfix/usr/lib/sasl2/smtpd.conf /usr/lib/sasl2/
[root@mail courier-authlib-0.62.4]# vi /usr/lib/sasl2/smtpd.conf //在这里没有这个文件,我查找后在/tmp/postfix/usr/lib/sasl2/smtpd.conf复制过来的
pwcheck_method: authdaemond
mech_list:PLAIN LOGIN
authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
:wq
[root@mail courier-authlib-0.62.4]# vim /etc/dovecot.conf
208 mail_location = maildir:/mailbox/%d/%n/Maildir
795 mechanisms = plain
828 #passdb pam {
857 #}
899 passdb sql {
900 # Path for SQL configuration file, see doc/dovecot-sql-example.conf
901 args = /etc/dovecot-mysql.conf
902 }
962 userdb sql {
963 # Path for SQL configuration file, see doc/dovecot-sql-example.conf
964 args = /etc/dovecot-mysql.conf
965 }
:wq
[root@mail courier-authlib-0.62.4]# vim /etc/postfix/main.cf
414 home_mailbox = Maildir/ //此处之前已经修改
建立数据查询配置文件,手动产生/etc/dovecot-mysql.conf文件
[root@mail courier-authlib-0.62.4]# 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'
[root@mail ~]# mkdir -p /mailbox/extmail.org/postmaster/Maildir/
[root@mail ~]# cd /mailbox/extmail.org/postmaster/Maildir/
[root@mail Maildir]# chown -R postfix:postfix /mailbox/
[root@mail Maildir]#dovecot
[root@mail Maildir]# /usr/local/courier-authlib/sbin/authtest -s login postmaster@extmail.org extmail //测试虚拟用户认证,下面已经看到认证成功
Authentication succeeded.
Authenticated: postmaster@extmail.org (uid 1000, gid 1000)
Home Directory: /mailboxextmail.org/postmaster
Maildir: /mailboxextmail.org/postmaster/Maildir/
Quota: 104857600S
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0
Cleartext Password: extmail
Options: (none)
[root@mail ~]#
搭建 Extmail平台
基于Perl 语言开发的中文Webmail管理平台
套件:ExtMail --Web 界面的邮件操作
Extman –Web 界面的邮件系统管理
[root@mail mnt]# tar -zxvf Unix-Syslog-1.1.tar.gz -C /usr/src/
Unix-Syslog-1.1/
Unix-Syslog-1.1/README
Unix-Syslog-1.1/Changes
Unix-Syslog-1.1/test.pl
Unix-Syslog-1.1/Artistic
Unix-Syslog-1.1/Makefile.PL
Unix-Syslog-1.1/META.yml
Unix-Syslog-1.1/Syslog.pm
Unix-Syslog-1.1/Syslog.xs
Unix-Syslog-1.1/MANIFEST
[root@mail mnt]#
[root@mail mnt]# cd /usr/src/Unix-Syslog-1.1/
[root@mail Unix-Syslog-1.1]# ll
总计 60
-rw-r--r-- 1 user1 bin 8902 2007-10-03 Artistic
-rw-r--r-- 1 user1 bin 3659 2008-05-19 Changes
-rw-r--r-- 1 user1 bin 463 2008-05-19 Makefile.PL
-rw-r--r-- 1 user1 bin 152 2008-05-19 MANIFEST
-rw-r--r-- 1 user1 bin 296 2008-05-19 META.yml
-rw-r--r-- 1 user1 bin 5642 2007-10-03 README
-rw-r--r-- 1 user1 bin 9287 2008-05-19 Syslog.pm
-rw-r--r-- 1 user1 bin 3928 2008-05-18 Syslog.xs
-rw-r--r-- 1 user1 bin 7108 2008-02-28 test.pl
[root@mail Unix-Syslog-1.1]#
[root@mail Unix-Syslog-1.1]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Unix::Syslog
[root@mail Unix-Syslog-1.1]# make && make install
[root@mail Unix-Syslog-1.1]# cd -
/mnt
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# tar -zxvf DB
DBD-mysql-4.020.tar.gz DBI-1.616.tar.gz
[root@mail mnt]# tar -zxvf DBI-1.616.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/DBI-1.616/
[root@mail DBI-1.616]# ll
总计 976
-rw-r--r-- 1 mysql mysql 106959 2010-12-30 Changes
-rw-r--r-- 1 mysql mysql 3139 2009-02-25 dbd_xsh.h
-rw-r--r-- 1 mysql mysql 1937 2009-09-02 dbilogstrip.PL
-rw-r--r-- 1 mysql mysql 308284 2010-12-22 DBI.pm
-rw-r--r-- 1 mysql mysql 174680 2010-07-30 dbipport.h
-rw-r--r-- 1 mysql mysql 6784 2009-09-14 dbiprof.PL
-rw-r--r-- 1 mysql mysql 5967 2009-09-14 dbiproxy.PL
-rw-r--r-- 1 mysql mysql 3747 2006-02-08 dbi_sql.h
-rw-r--r-- 1 mysql mysql 2016 2005-03-26 dbivport.h
-rw-r--r-- 1 mysql mysql 193557 2010-12-22 DBI.xs
-rw-r--r-- 1 mysql mysql 24174 2010-12-22 DBIXS.h
-rw-r--r-- 1 mysql mysql 148 2010-12-22 dbixs_rev.h
-rw-r--r-- 1 mysql mysql 1533 2007-07-16 dbixs_rev.pl
-rw-r--r-- 1 mysql mysql 22333 2010-07-30 Driver.xst
-rw-r--r-- 1 mysql mysql 3716 2009-09-14 Driver_xst.h
drwxr-x--- 2 mysql mysql 4096 05-28 19:24 ex
drwxr-x--- 6 mysql mysql 4096 05-28 19:24 lib
-rw-r--r-- 1 mysql mysql 13371 2010-09-03 Makefile.PL
-rw-r--r-- 1 mysql mysql 5456 2010-12-30 MANIFEST
-rw-r----- 1 mysql mysql 1078 2010-12-30 META.yml
-rw-r--r-- 1 mysql mysql 1677 2009-11-03 Perl.xs
-rw-r--r-- 1 mysql mysql 5594 2010-08-26 README
drwxr-x--- 2 mysql mysql 4096 05-28 19:24 t
-rwxr-xr-x 1 mysql mysql 5479 2009-02-25 test.pl
-rw-r--r-- 1 mysql mysql 21306 2009-05-02 TODO_2005.txt
-rw-r--r-- 1 mysql mysql 2718 2009-06-08 TODO_gofer.txt
-rw-r--r-- 1 mysql mysql 64 2005-04-11 typemap
[root@mail DBI-1.616]# perl Makefile.PL
[root@mail DBI-1.616]# make && make install
[root@mail DBI-1.616]# cd -
/mnt
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# tar -zxvf DBD-mysql-4.020.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/DBD-mysql-4.020/
[root@mail DBD-mysql-4.020]# ll
总计 356
-rwxr-xr-x 1 mysql games 61258 2011-08-21 ChangeLog
-rwxr-xr-x 1 mysql games 1948 2011-08-19 constants.h
-rwxr-xr-x 1 mysql games 146213 2011-08-21 dbdimp.c
-rwxr-xr-x 1 mysql games 10623 2011-08-21 dbdimp.h
drwxr-xr-x 2 mysql games 4096 2011-08-21 eg
-rwxr-xr-x 1 mysql games 29285 2011-08-21 INSTALL.html
drwxr-xr-x 4 mysql games 4096 2011-08-21 lib
-rwxr-xr-x 1 mysql games 31297 2011-08-21 Makefile.PL
-rw-r--r-- 1 mysql games 713 2011-08-19 Makefile.PL.embedded
-rwxr-xr-x 1 mysql games 1240 2011-08-19 MANIFEST
-rwxr-xr-x 1 mysql games 41 2011-08-19 MANIFEST.SKIP
-rw-r--r-- 1 mysql games 697 2011-08-21 META.yml
-rwxr-xr-x 1 mysql games 1709 2011-08-19 myld
-rwxr-xr-x 1 mysql games 22505 2011-08-21 mysql.xs
-rwxr-xr-x 1 mysql games 3387 2011-08-19 README
drwxr-xr-x 2 mysql games 4096 2011-08-21 t
-rw-r--r-- 1 mysql games 896 2011-08-19 TODO
[root@mail DBD-mysql-4.020]# perl Makefile.PL
[root@mail DBD-mysql-4.020]# make && make install //三个包在编译安装过程提示的 警告信息 隐式函数 计算出的变量值未被使用等,只要没有error信息就一切ok
[root@mail DBD-mysql-4.020]# cd -
/mnt
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# tar -zxvf extmail-1.2.tar.gz -C /usr/local/apache2/htdocs/
[root@mail mnt]# cd /usr/local/apache2/htdocs/
[root@mail htdocs]# ll
总计 16
drwxr-xr-x 7 test test 4096 2009-12-25 extmail-1.2
-rw-r--r-- 1 root root 45 2007-06-12 index.html
-rw-r--r-- 1 root root 20 05-26 21:58 index.php
drwxr-xr-x 17 root root 4096 05-27 21:36 webmail
[root@mail htdocs]#
[root@mail htdocs]# mv extmail-1.2/ extmail
[root@mail htdocs]# cd extmail/
[root@mail extmail]# ll
总计 168
-rw-r--r-- 1 test test 410 2007-01-26 AUTHORS
drwxr-xr-x 2 test test 4096 2009-11-07 cgi
-rw-r--r-- 1 test test 61170 2009-12-18 ChangeLog
-rw-r--r-- 1 test test 900 2006-02-20 CREDITS
-rwxr-xr-x 1 test test 14477 2009-11-07 dispatch.fcgi
-rwxr-xr-x 1 test test 1743 2009-11-07 dispatch-init
-rwxr-xr-x 1 test test 234 2007-10-09 dispatch_lig.sh
-rw-r--r-- 1 test test 1305 2007-10-09 FAQ
-rw-r--r-- 1 test test 90 2008-06-09 globabook.cf
drwxr-xr-x 5 test test 4096 2007-10-09 html
-rw-r--r-- 1 test test 3728 2008-02-24 INSTALL
drwxr-xr-x 2 test test 4096 2009-12-18 lang
drwxr-xr-x 7 test test 4096 2009-11-10 libs
-rw-r--r-- 1 test test 2771 2009-11-07 README
-rw-r--r-- 1 test test 12677 2008-10-13 README.fcgi
-rw-r--r-- 1 test test 1263 2009-11-07 README.filter
-rw-r--r-- 1 test test 2281 2007-02-15 README.vpopmail
drwxr-xr-x 2 test test 4096 2009-11-07 tools
-rw-r--r-- 1 test test 4 2009-12-25 Version
-rw-r--r-- 1 test test 6808 2009-12-18 webmail.cf.default
[root@mail extmail]#
[root@mail extmail]# chown -R postfix.postfix cgi/
[root@mail extmail]# cp webmail.cf.default webmail.cf
[root@mail extmail]# vi webmail.cf
2 SYS_CONFIG = /usr/local/apache2/htdocs/extmail/
5 SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang
8 SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html/
127 SYS_MAILDIR_BASE = /mailbox
139 SYS_MYSQL_USER = extmail
140 SYS_MYSQL_PASS = extmail
141 SYS_MYSQL_DB = extmail
142 SYS_MYSQL_HOST = localhost
143 SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
配置虚拟主机
[root@mail extmail]# vi /usr/local/apache2/conf/httpd.conf
157 User postfix
158 Group postfix
//下面的内容是在最后添加进去的
491 NameVirtualHost *:80
492 <VirtualHost *:80>
493 ServerName mail.chenkui.com
494 DocumentRoot /usr/local/apache2/htdocs/extmail/html/
495 ScriptAlias /extmail/cgi/ "/usr/local/apache2/htdocs/extmail/cgi/"
496 Alias /extmail/ /usr/local/apache2/htdocs/extmail/html/
497 </VirtualHost>
[root@mail extmail]# /usr/local/apache2/bin/apachectl restart
打开浏览器输入:http://mail.chenkui.com,此时可以看到extmail的界面了!!!!!
//美中不足的是我这里web界面图片无法显示,查看了图片路径指向的是正常的,但不知为何,希望大家帮忙看看,如有错误请指出,谢谢!
安装Extman
[root@mail htdocs]# cd /mnt
[root@mail mnt]# ll
[root@mail mnt]# tar -zxvf GD-2.46.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/GD-2.46/
[root@mail GD-2.46]# ll
总计 224
drwxr-xr-x 2 postfix postfix 4096 2011-05-02 bdf_scripts
-rw-r--r-- 1 postfix postfix 7122 2011-05-02 ChangeLog
drwxr-xr-x 2 postfix postfix 4096 2011-05-02 demos
drwxr-xr-x 2 postfix postfix 4096 2011-05-02 GD
-rw-r--r-- 1 postfix postfix 60602 2011-05-02 GD.pm
-rw-r--r-- 1 postfix postfix 48735 2009-01-12 GD.xs
-rw-r--r-- 1 postfix postfix 11758 2011-02-06 Makefile.PL
-rw-r--r-- 1 postfix postfix 1438 2011-05-02 MANIFEST
-rw-r--r-- 1 postfix postfix 543 2011-05-02 META.yml
-rw-r--r-- 1 postfix postfix 32810 2001-12-07 qd.pl
-rw-r--r-- 1 postfix postfix 17139 2011-02-06 README
-rw-r--r-- 1 postfix postfix 467 2001-12-07 README.QUICKDRAW
-rw-r--r-- 1 postfix postfix 2221 2001-12-07 README.unix
drwxr-xr-x 2 postfix postfix 4096 2011-05-02 t
-rw-r--r-- 1 postfix postfix 66 2001-12-07 typemap
[root@mail GD-2.46]# perl Makefile.PL
[root@mail GD-2.46]# make && make install
[root@mail GD-2.46]# cd -
/mnt
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# tar -zxvf File-Tail-0.99.3.tar.gz -C /usr/src/
[root@mail mnt]# cd /usr/src/File-Tail-0.99.3/
[root@mail File-Tail-0.99.3]# ll
总计 92
-rw-r--r-- 1 10008 dip 4812 2005-09-14 Changes
-rwxr-xr-x 1 10008 dip 1381 1999-11-03 logwatch
-rw-r--r-- 1 10008 dip 2471 2000-10-17 Makefile.PL
-rw-r--r-- 1 10008 dip 198 2005-09-14 MANIFEST
-rw-r--r-- 1 10008 dip 452 2005-09-14 META.yml
-rw-r--r-- 1 10008 dip 2143 1999-02-03 README
-rwxr-xr-x 1 10008 dip 1101 1999-02-03 select_demo
drwxr-xr-x 2 10008 dip 4096 2005-09-14 t
-rw-r--r-- 1 10008 dip 25308 2005-09-14 Tail.pm
-rw-r--r-- 1 10008 dip 27991 2005-09-14 Tail.pm.debug
[root@mail File-Tail-0.99.3]#
[root@mail File-Tail-0.99.3]# perl Makefile.PL
File::Tail will be installed without debugging information.
This information isn't usefull unless you intend to tinker
with the code. To install with debugging enabled, use:
perl Makefile.PL LOGIT
Checking if your kit is complete...
Looks good
Writing Makefile for File::Tail
[root@mail File-Tail-0.99.3]# make && make install
[root@mail File-Tail-0.99.3]# cd -
/mnt
[root@mail mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@mail mnt]# rpm -ivh rrdtool-1.2.23-3.el5.i386.rpm
warning: rrdtool-1.2.23-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:rrdtool ########################################### [100%]
[root@mail mnt]# rpm -ivh rrdtool-perl-1.2.23-3.el5.i386.rpm
warning: rrdtool-perl-1.2.23-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ########################################### [100%]
1:rrdtool-perl ########################################### [100%]
[root@mail mnt]#
[root@mail mnt]# tar -zxvf extman-1.1.tar.gz -C /usr/local/apache2/htdocs/
[root@mail mnt]# cd /usr/local/apache2/htdocs/
[root@mail htdocs]# ll
总计 20
drwxr-xr-x 7 test test 4096 05-28 19:39 extmail
drwxr-xr-x 11 test test 4096 2009-12-24 extman-1.1
-rw-r--r-- 1 root root 45 2007-06-12 index.html
-rw-r--r-- 1 root root 20 05-26 21:58 index.php
drwxr-xr-x 17 root root 4096 05-27 21:36 webmail
[root@mail htdocs]#
[root@mail htdocs]# mv extman-1.1/ extman/
[root@mail htdocs]# cd extman/
[root@mail extman]# ll
总计 100
drwxr-xr-x 3 test test 4096 2009-05-03 addon
-rw-r--r-- 1 test test 140 2005-10-22 AUTHORS
drwxr-xr-x 2 test test 4096 2009-05-09 cgi
-rw-r--r-- 1 test test 20812 2009-12-24 ChangeLog
drwxr-xr-x 2 test test 4096 2009-12-24 contrib
drwxr-xr-x 3 test test 4096 2009-12-24 daemon
drwxr-xr-x 2 test test 4096 2009-11-07 docs
drwxr-xr-x 5 test test 4096 2009-12-24 html
-rw-r--r-- 1 test test 3860 2007-02-13 INSTALL
drwxr-xr-x 2 test test 4096 2009-11-08 lang
drwxr-xr-x 6 test test 4096 2009-07-20 libs
-rw-r--r-- 1 test test 2112 2007-03-06 README
-rw-r--r-- 1 test test 13723 2008-09-25 README.fcgi
drwxr-xr-x 2 test test 4096 2009-12-24 tools
-rw-r--r-- 1 test test 4 2009-12-24 Version
-rw-r--r-- 1 test test 5046 2009-11-08 webman.cf.default
[root@mail extman]#
[root@mail extman]# chown -R postfix.postfix cgi/
[root@mail extman]# mkdir /tmp/extman
[root@mail extman]# chown -R postfix.postfix /tmp/extman/
[root@mail extman]# cp webman.cf.default webman.cf
[root@mail extman]# vi webman.cf
2 SYS_CONFIG = /usr/local/apache2/htdocs/extman/
5 SYS_LANGDIR = /usr/local/apache2/htdocs/extman/lang
8 SYS_TEMPLDIR = /usr/local/apache2/htdocs/extman/html
12 SYS_MAILDIR_BASE = /mailbox
127 SYS_MYSQL_USER = webman
128 SYS_MYSQL_PASS = webman
129 SYS_MYSQL_DB = extmail
130 SYS_MYSQL_HOST = localhost
131 SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
:wq
[root@mail extman]# vi /usr/local/apache2/conf/httpd.conf
491 NameVirtualHost *:80
492 <VirtualHost *:80>
493 ServerName mail.chenkui.com
494 DocumentRoot /usr/local/apache2/htdocs/extmail/html/
495 ScriptAlias /extmail/cgi/ "/usr/local/apache2/htdocs/extmail/cgi/"
496 Alias /extmail/ "/usr/local/apache2/htdocs/extmail/html/"
497 ScriptAlias /extman/cgi/ "/usr/local/apache2/htdocs/extman/cgi/" // 在之前的基础上添加的
498 Alias /extman "/usr/local/apache2/htdocs/extman/html/" //在之前的基础上添加的
499 </VirtualHost>
此时可以打开后台管理界面了 http://mail.chenkui.com/extman //注意客户机要与服务器时间一致,否则会登录不上
默认帐户:root@extmail.org
默认密码:extmail*123*
设置邮件系统的图形化日志信息
[root@mail ~]# ln -sf /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/mailgraph-init /usr/sbin/
[root@mail ~]# ln -sf /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/qmonitor.pl /usr/sbin/
[root@mail ~]# cp -a /usr/local/apache2/htdocs/extman/addon/mailgraph_ext/ /usr/local/ -a //相当于 -pdr 的意思;-d :若来源文件为连结文件的属性(link
file),则复制连结文件属性而非档案本身;-f :为强制 (force) 的意思,若有重复或其它疑问时,不会询问使用者,而强制复制;-p :连同档案的属性一起复制过去,而非使用
预设属性;
[root@mail ~]# mailgraph-init start
Starting mail statistics grapher: mailgraph_ext
Starting queue statistics grapher: qmonitor
[root@mail ~]# qmonitor.pl start & //&表示在后台运行
[1] 4355
[root@mail ~]#
[root@mail ~]# echo "/usr/sbin/qmonitor.pl start" >> /etc/rc.d/rc.local //开机自启动
[root@mail ~]# echo "/usr/sbin/mailgraph-init start" >> /etc/rc.d/rc.local
[root@mail ~]#
登录Extman后台,打开 系统——图形日志,可以看到邮件投递分析图表
//在extman后台,我没有截图,都是中文界面,相信大家都知道怎么操作,如何添加新域,添加管理员、用户、配置模板等等。
配置垃圾邮件过滤
[root@mail ~]# vi /etc/postfix/main.cf
657 smtpd_client_restrictions = check_client_access hash:/etc/postfix/access //添加此行
[root@mail GD-2.46]# vi /etc/postfix/access
445 192.168.1 REJECT //拒绝来自192.168.1.0网段的邮件
446 192.168.10.100 OK //接收来自192.168.10.1的邮件
447 qq.com REJECT //拒绝来自QQ的邮件
[root@mail ~]# postmap /etc/postfix/access //转换为hash数据库文件access.db
根据客户机helo信息中的主机名地址过滤邮件。
[root@mail ~]# vi /etc/postfix/main.cf //在最后添加下面两行
658 smtpd_helo_required = yes
659 smtpd_helo_restrictions = reject_invaild_hostname
根据发件人的地址过滤邮件
[root@mail ~]# vi /etc/postfix/main.cf
smtpd_sender_login_maps = mysql:/etc/postfix/mysql_virtu l_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/sen
der_access
设置发件人地址访问控制策略,拒绝由user1@sina.cn,任何域的admin用户及来处mail.qq.com的用户发送的邮件。
[root@mail ~]# vi /etc/postfix/sender_access
user1@sina.cn REJECT
admin@ REJECT
mail.qq.com REJECT
[root@mail ~]# postmap /etc/postfix/sender_access
[root@mail ~]# service postfix restart
设置收件人地址访问控制策略
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,reject_non_fqdn_recipient,reject_unknown_recipient_domain
基于邮件内容过滤
[root@mail mnt]# tar -zxvf MailScanner-4.84.3-1.rpm.tar.gz -C /usr/local/src/
[root@mail mnt]# cd /usr/local/src/MailScanner-4.84.3-1/
[root@mail mnt]# ./install.sh
[root@mail MailScanner-4.84.3-1]# vi /etc/MailScanner/MailScanner.conf
131 Run As User = postfix //将运行程序的用户设置为Postfix
136 Run As Group = postfix //将运行程序的用户组设置为Postfix
165 Incoming Queue Dir = /var/spool/postfix/hold //设置待过滤处理邮件队列目录
169 Outgoing Queue Dir = /var/spool/postfix/incoming // 设置过滤处理后的邮件队列目录
196 MTA = postfix //设置MTA服务器名称
2231 Required SpamAssassin Score = 7 //高于7的视为垃圾邮件 ——垃圾邮件有个评分标准,对于国内的一般设置为7或者以上
2237 High SpamAssassin Score = 10 //高于10的视为高分垃圾邮件
2437 Spam Actions = deliver header "X-Spam-Status: Yes" //对非高分垃圾邮件采取的动作
2499 High Scoring Spam Actions = delete forward spam@extmail.org //对高分垃圾邮件采取的动作
[root@mail MailScanner-4.84.3-1]# vi /etc/postfix/main.cf //在main.cf中启用header_checks配置参数,设置Postfix对邮件标头进行模式匹配检查,并在模式查询表文件“/etc/postfix/header_checks”中设置/^Received:/HOLD 匹配模式,从而将接收的所有邮件都放入到hold队列中,交由MailScanner扫描调度工具处理
519 header_checks = regexp:/etc/postfix/header_checks
[root@mail MailScanner-4.84.3-1]# vi /etc/postfix/header_checks //设置使用模式查询表
497 /^Received:/HOLD
[root@mail MailScanner-4.84.3-1]# chown -R postfix:postfix /var/spool/MailScanner/incoming/
[root@mail MailScanner-4.84.3-1]# chown -R postfix:postfix /var/spool/MailScanner/quarantine/
[root@mail MailScanner-4.84.3-1]# service MailScanner start
Starting MailScanner daemons:
incoming postfix: [确定]
outgoing postfix: [确定]
MailScanner: [确定]
[root@mail MailScanner-4.84.3-1]#
[root@mail MailScanner-4.84.3-1]# chkconfig --add MailScanner
[root@mail MailScanner-4.84.3-1]# chkconfig MailScanner on
[root@mail MailScanner-4.84.3-1]# chkconfig --list MailScanner
MailScanner 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@mail MailScanner-4.84.3-1]# service postfix restart
[root@mail ~]# yum -y install spamassassin //挂载系统光盘包安装
[root@mail ~]# spamassassin //其配置文件位于/etc/mail//spamassassin/local.cf 中,但是保持默认即可
[root@mail ~]#
[root@mail ~]# service spamassassin start
启动 spamd: [确定]
[root@mail ~]#
在配置F-Port病毒查杀软件时要接入Internet,下面我的虚拟机已经可以上网了
[root@mail mnt]# ping baidu.com
PING baidu.com (220.181.111.85) 56(84) bytes of data.
64 bytes from baidu.com (220.181.111.85): icmp_seq=1 ttl=53 time=71.6 ms
64 bytes from baidu.com (220.181.111.85): icmp_seq=2 ttl=53 time=74.4 ms
64 bytes from baidu.com (220.181.111.85): icmp_seq=3 ttl=53 time=106 ms
--- baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 71.647/84.198/106.523/15.828 ms
[root@mail mnt]# cat /etc/resolv.conf
nameserver 192.168.10.1
[root@mail mnt]#
[root@mail mnt]# tar -zxvf fp-Linux-i686-ws.tar.gz -C //配置F-Port 病毒查杀软件
[root@mail mnt]# cd /opt/f-prot/
[root@mail f-prot]# ll
总计 28856
-rw-r--r-- 1 user1 users 27622812 2008-04-29 antivir.def
drwxr-xr-x 4 user1 users 4096 2008-04-29 doc
-rw-r--r-- 1 user1 users 9383 2008-04-29 f-prot.conf.default
-rwxr-xr-x 1 user1 users 1519972 2008-04-29 fpscan
-rwxr-xr-x 1 user1 users 285032 2008-04-29 fpupdate
-rwxr-xr-x 1 user1 users 40063 2008-04-29 install-f-prot.pl
-rw-r--r-- 1 user1 users 55 2008-04-29 license.key
lrwxrwxrwx 1 user1 users 20 05-31 07:15 product.data -> product.data.default
-rw-r--r-- 1 user1 users 13 2008-04-29 product.data.default
-rw-r--r-- 1 user1 users 6192 2008-04-29 README
[root@mail f-prot]#
[root@mail f-prot]# ./install-f-prot.pl
(c) FRISK Software International
http://www.f-prot.com/
You are about to install F-Prot Antivirus for Linux Workstations
on a RedHat Linux 2.6.18 running on i686 into the '/opt/f-prot'
directory
Where do you want a symbolic link to 'F-Prot Antivirus command line scanner (fpscan)' to be created?
(Just press Enter to accept the default) [/usr/local/bin]:
Where do you want a symbolic link to 'section 8 manuals' to be created?
(Just press Enter to accept the default) [/usr/local/man/man8]:
Where do you want a symbolic link to 'section 1 manuals' to be created?
(Just press Enter to accept the default) [/usr/local/man/man1]:
Where do you want a symbolic link to 'section 5 manuals' to be created?
(Just press Enter to accept the default) [/usr/local/man/man5]:
Changing file access permissions on the installed files and directories ...ok
Checking if you have an existing license key...yes
Found an existing license key in /opt/f-prot/license.key, updating antivir.def ...
Downloading update (%100) //已经自动从网上下载更新
We've generated the following crontab entries to update the
antivir.def file via fpupdate. Updates will be run hourly at a
randomly picked minute to distribute load, and thus make your updates
faster than if they were run during obvious high load times, e.g. on
the hour.
The global crontab entry we made to add to /etc/crontab is the following:
31 * * * * root /opt/f-prot/fpupdate > /dev/null
Would you like to have this crontab appended to /etc/crontab?
(Just press Enter to accept the default) [Y/n]: Y
All done!
If you reconfigured your MTA you should restart it now to activate the changes.
Have a nice day
Frisk software (www.f-prot.com)
[root@mail f-prot]# ll
总计 60000
-rw-r--r-- 1 user1 users 59467267 05-31 07:31 antivir.def
drwxr-xr-x 4 user1 users 4096 2008-04-29 doc
-rw-r--r-- 1 root root 9383 05-31 07:20 f-prot.conf
-rw-r--r-- 1 user1 users 9383 2008-04-29 f-prot.conf.default
-rwxr-xr-x 1 user1 users 1519972 2008-04-29 fpscan
-rwx------ 1 user1 users 285032 2008-04-29 fpupdate
-rwxr-xr-x 1 user1 users 40063 2008-04-29 install-f-prot.pl
-rw-r--r-- 1 user1 users 55 2008-04-29 license.key
lrwxrwxrwx 1 user1 users 20 05-31 07:15 product.data -> product.data.default
-rw-r--r-- 1 user1 users 13 2008-04-29 product.data.default
-rw-r--r-- 1 user1 users 6192 2008-04-29 README
[root@mail f-prot]# /opt/f-prot/fpupdate
[root@mail f-prot]# [确定]
[root@mail ~]# crontab -e
00 23 * * * /opt/f-port/fpupdate //设置每天晚上11点自动更新病毒库
[root@mail ~]# service crond restart
停止 crond: [确定]
启动 crond: [确定]
[root@mail ~]# chkconfig --level 35 crond on
测试邮件内容过滤及病毒测试
登录postmaster@extmail.org,给自己发一封测试邮件,内容分别包含下面字符串,在日志中查看效果
测试邮件内容过滤,下面是一段字符串:
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
测试邮件防病毒机制
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
本实验很多参考了北大青鸟benet 3.0课程教材,之前做这个实验,用的版本有所不同,但是没出现什么问题,就是在最后病毒测试一项,没有见到效果,这个大家可以换其他的杀毒软件试试,以上如有错误请指出,本人会及时更正,谢谢!
转载于:https://blog.51cto.com/loveroot/882443