PXE安装Centos
postfix+exmail+mysql实现基于
虚拟用户的web邮件系统
在实现centos+postfix的web内网邮件之前,参考了许多网上、书本知识,经过两次大的改动,目前该系统已经为公司正常服务工作五年多。
第一部分 win7+tftpd32+PXE安装CentOS6.5 32bit
第一步 安装CentOS6.5 32bit操作系统
基于win7+tftpd32+PXE来安装,但我这里只用虚拟机VMware Workstation9.0.1 build-894247来实现,真机Dell R210 2代经过实际测试也可以用这个方法实现。
1、在任意盘符下新建一个文件夹tftpboot,把下载下来的Tftpd32和hfs2.3b271两个文件夹放进去,再新建一个文件夹pxe。
2、用UltraISO解压CentOS6.532bit的两个ISO文件,如下:
它有两个ISO文件,全部解压缩到两个目录里去。一般只要第一个就可以。
顺便说一下,这里必须用ISO工具解开,不要用WinRAR图省事,否则后面不能正常安装。可以试一下,用winrar解开后,在repodata下看不到文件后缀名,后面安装就提示找不到文件
3、把前面解压缩下来的F:\centos65_32bit_1\isolinux\文件夹内的两个文件:vmlinuz、initrd.img放入X:\tftpboot\pxe目录下,并且在pxe目录下新建一个pxelinux.cfg目录,把前面解压缩下来的F:\centos65_32bit_1\isolinux\isolinux.cfg文件放入新建的pxelinux.cfg目录,并且改名为default,再用文本编辑器notepad打开它:
default vesamenu.c32
#prompt 1
timeout600
displayboot.msg
menubackground splash.jpg
menutitle Welcome to CentOS 6.5!
menucolor border 0 #ffffffff #00000000
menucolor sel 7 #ffffffff #ff000000
menucolor title 0 #ffffffff #00000000
menucolor tabmsg 0 #ffffffff #00000000
menucolor unsel 0 #ffffffff #00000000
menucolor hotsel 0 #ff000000 #ffffffff
menucolor hotkey 7 #ffffffff #ff000000
menucolor scrollbar 0 #ffffffff #00000000
labellinux
menu label ^Install or upgrade an existingsystem
menu default
kernel vmlinuz
append initrd=initrd.img
label vesa
menu label Install systemwith ^basic video driver
kernel vmlinuz
append initrd=initrd.imgxdriver=vesa nomodeset
label rescue
menu label ^Rescue installedsystem
kernel vmlinuz
append initrd=initrd.imgrescue
label local
menu label Boot from ^localdrive
localboot 0xffff
label memtest86
menu label ^Memory test
kernel memtest
append -
把标红色字的全部删除或者用'#'注释掉。
还有一个pxelinux.0文件,可以从已经装好CentOS的机器上找到:/usr/share/sysliux/pxelinux.0,我没有测试pxelinux.0这个文件有没有版本要求,我是从已经装好的CentOS6.5 64bit机器上拿过来给32bit机器用的。
4、设置网络
做今个实验只能用有线连接,说白了就是只要你的有线网卡能工作就行。
我现在就禁用了无线网卡;
而有线网卡的ip地址手工分配:
这是本机的网络设置,下面还要设置新安装的Vmware的网络
具体怎样使用vmware来新建一个虚拟机,我不讲了,但是这个新建好的虚拟机的网络一定要改成上图的1或者2。
5、设置Tftpd32
来到X:\tftpboot\Tftpd32\(这里的X代表你个人的盘符)下,双击打开tftpd32.exe程序
在“当前目录”写X:\tftpboot\pxe,点击“显示目录”按钮,能看到initrd.img、pxelinux.0、vmlinuz这三个文件就可以:
点击Tftpd32.exe的“设置”按钮,下面分别来设置tftp、dhcp:
1、TFTP设置:我们可以看到“Tftpd32:设置”对话框,选择“TFTP”选项卡,在“基本目录”里和“当前目录”一样,其它直接看下图:
2:DHCP设置:选中“DHCP”选项卡,不要选“分配前PING地址”,“Boot文件”只能写pxelinux.0;其它照下图:
6、关闭本机上的所有防火墙,在后面安装过程中可能会发生误报从而停止安装
7、设置hfs2.3b271
在X:\tftpboot\hfs2.3b271目录下,找到并打开hfs.exe文件,如下图:
在左边有小房子的空白区域内右击鼠标,选中“从磁盘添加目录”,如下图:
找到文件夹的位置,会出现下面的提示,选中“真实目录”
现在改一下它的端口号,如下图:
单击图上“端口:8080”,弹出对话框,直接改成80即可。
现在测试一下:
请照下图做,先用鼠标左键选中“虚拟文件系统”中的文件夹,它会变成蓝底
再单击“在浏览器中打开”,没有问题的话是可以在浏览器中看到我们的所有文件,如下图:
测试正常,完毕。
8、PXE安装开始
开启虚拟机电源,如果没有问题的话,虚拟机可以从Tftpd32获得地址,正常引导如下图:
在“boot”后面打“linux”即可。
从下图可以看出Tftpd32的tftp在正常工作:
到了下图的“Installation Method”了,只选“URL”:
我只选择了ipv4的,不改也是一样的。
这下一步就写URL地址,就比照hfs.exe的地址写上去就是,如下图:
注意:不可以用centos6.5 64bit的initrd.img、vmlinuz来安装32bit的系统,但我的pxelinux.0还是64bit的,没有报错误。
也就是说:
initrd.img、vmlinuz是分版本的,64和32bit不能混用。
剩下的安装部分就不说了,很多人把安装过程说的已经烂了。
有条件的,就多给/var些空间。
第二部分postfix+extmail+mysql
实现基于虚拟用户的邮件系统
这一部分采用虚拟机做的,初装完系统,第一件事就是装vmware tool
第一步 安装vmware tool
利用命令行安装:
[root@mailDesktop]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 18G 8.2G 8.5G 50% /
tmpfs tmpfs 504M 76K 504M 1% /dev/shm
/dev/sda1 ext4 194M 28M 156M 16% /boot
/dev/sr0 iso9660 64M 64M 0 100% /media/VMwareTools
[root@mailDesktop]# cd /media/VMware\ Tools/
[root@mail VMware Tools]# ll
total64808
-r-xr-xr-x.1 root root 1962 Nov 1 2012manifest.txt
-r--r--r--.1 root root 66361242 Nov 1 2012 VMwareTools-9.2.2-893683.tar.gz
[root@mailVMware Tools]# tar zxf VMwareTools-9.2.2-893683.tar.gz -C /usr/local/src/
[root@mailVMware Tools]# cd /usr/local/src
[root@mailvmware-tools-distrib]# ./vmware-install.pl
后面有提示就是一路回车。
第二步 配置上网环境
虚拟机还是用VMnet0,如下图:
图中标记的地方用1或者2都可以
下面就要确保本机能上网,那么虚拟机也就一定能上网了
[root@mailDesktop]# service network restart(命令执行后没有什么特别的就不贴)
[root@mailDesktop]# ping www.sina.com -c1
PINGpolaris.sina.com.cn (202.108.33.60) 56(84) bytes of data.
64 bytes from 202.108.33.60: icmp_seq=1 ttl=245 time=74.2 ms(虚拟机里也可以上网)
---polaris.sina.com.cn ping statistics ---
1packets transmitted, 1 received, 0% packet loss, time 76ms
rttmin/avg/max/mdev = 74.213/74.213/74.213/0.000 ms
第二步 把要用的软件放到虚拟机上
由于使用了VMware tool工具,所以可以很方便的把必要的文件放到虚拟机上。
否则就要用wget把文件传上来。
[root@mail123]# tree
.
├── courier-authlib-0.66.1.tar.bz2
├── extmail-1.2.tar.gz
├── extman-1.1.tar.gz
├── File-Tail-0.99.3.tar.gz
├── perl-GD-2.45-1.el6.rfx.i686.rpm
├── postfix-2.10.1.tar.gz
├── rrdtool-1.4.7.tar.gz
├── Time-HiRes-1.9719.tar.gz
└── Unix-Syslog-1.1.tar.gz
0directories, 9 files
我就直接把必要的文件直接从win7上拖放到linux桌面上。
顺便提一下,centos6.5居然没有tree命令,搞什么啊,那就装吧:
[root@mail123]# yum install tree
ok了,有tree这个命令可用。
第三步 安装所有必要软件包
yum install -y bind bind-chroot httpd php php-mysql mysqlmysql-server mysql-devel openssl-devel dovecot* perl-DBD-MySQL tcl tcl-develexpect db* cyrus* libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-develzlib libpng freetype perl-GD rrdtool rrdtool-deverrdtool-perl
这里补充一下,在centos6.x版本中不再提供bind的caching-nameserver文件包。
第四步 关闭sendmail、iptables、selinux
[root@mail~]# service iptables status
Table:filter
ChainINPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
.....后面省略
[root@mail~]# service iptables stop
iptables:Setting chains to policy ACCEPT: filter [ OK ]
iptables:Flushing firewall rules: [ OK ]
iptables:Unloading modules: [ OK ]
[root@mail~]# chkconfig iptables off
[root@mail~]# setenforce 0 临时关闭selinux
[root@mail~]# cat /etc/selinux/config
#This file controls the state of SELinux on the system.
#SELINUX= can take one of these three values:
# enforcing - SELinux security policy isenforced.
# permissive - SELinux prints warningsinstead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing 把这里改成disabled,重启系统就永久关闭
#SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes areprotected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@mail~]# rpm -qa | grep sendmail
[root@mail~]# service sendmail status
sendmail:unrecognized service 看来是没装sendmail
第五步 创建一个独立的网络
先修改vmware 的网络
在“开始”菜单里找到"Virtual Network Editor"这个工具,打开它
我们要新增一个网络VMnet7,如下图:
下面来设置VMnet7的网络,按照下图的1、2、3顺序来:
接着上面的第3项“DHCP Settings...”,打开一个设置IP的对话框,如下图:
把其中的开始、结束地址写好,按“OK”结束。
回到第一个界面,按“OK”结束Virtual Network Editor设置:
现在就可以断虚拟机的网络了,把它原来是VMnet0改为VMnet7,如下图:
再新增一台虚拟机winxp(其它也可以)做为测试机器。两台机器全在VMnet7里,这样一来就形成了一个独立的网络。这里提一下,不加测试的winxp也可以的,那就用宿主机和centos测试。
CentOS6.5还要重启网络进程:
[root@mail~]# service network restart
第六步 设置bind
1、设置主机名称
[root@mail~]# hostname
mail.gjyonline.com 安装的时候设置的
[root@mail~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mail.gjyonline.com 就在这里把HOSTNAME改在你想要的名字,但要重启系统才会生效
2、设置固定地址
[root@mail~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:7F:2F:C9"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="e76eed2a-8e3f-496e-96f5-aeb7817608c7"
IPADDR=172.16.1.250
NETMASK=255.255.255.0
GATEWAY=172.16.1.1
DNS1=172.16.1.250
3、设置DNS文件
[root@mail~]# cat /etc/resolv.conf
#Generated by NetworkManager
searchgjyonline.com
nameserver172.16.1.250
4、配置hosts文件
[root@mail~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4localhost4.localdomain4
::1 localhost localhost.localdomainlocalhost6 localhost6.localdomain6
172.16.1.250mail.gjyonline.com
5、配置bind
从这里开始都是从本地真机使用SecureCRT连接到VMWare里的CentOS6.5。
所有的工作到了这里,才算开始
[root@mail~]# vi /etc/named.conf
11 listen-on port 53 { any; };
12 //listen-on-v6 port 53 { ::1; };
17 allow-query { any; };
18 recursion no;
[root@mail~]# vi /etc/named.rfc1912.zones
在最后增加:
43 zone "gjyonline.com" IN {
44 type master;
45 file "gjyonline.com.zero";
46 allow-update { none; };
47 };
48
49 zone "1.16.172.in-addr.arpa"IN {
50 type master;
51 file "1.16.172.local";
52 allow-update { none; };
53 };
bind的配置文件是/etc/named.conf、/etc/named.rfc1912.zones,但启动named后,可以在/var/named/chroot/etc 里面看到named.conf、named.rfc1912.zones两个文件,好像是做了hard link,还有其它的密钥文件;但关闭named后,/var/named/chroot/etc里面就没有这些文件。
下面配置正、反向文件
[root@mailnamed]# cd /var/named/chroot/var/named/
[root@mailnamed]# ll
total32
drwxr-x---.6 root named 4096 Jan 24 16:00 chroot
drwxrwx---.2 named named 4096 Jan 21 01:37 data
drwxrwx---.2 named named 4096 Jan 21 01:37 dynamic
-rw-r-----.1 root named 1892 Feb 18 2008 named.ca
-rw-r-----.1 root named 152 Dec 15 2009 named.empty
-rw-r-----.1 root named 152 Jun 21 2007 named.localhost
-rw-r-----.1 root named 168 Dec 15 2009 named.loopback
drwxrwx---.2 named named 4096 Jan 21 01:37 slaves
[root@mailnamed]# cp -p named.empty gjyonline.com.zero
[root@mailnamed]# cp -p named.empty 1.16.172.local
[root@mail named]# cat gjyonline.com.zero
$TTL 72H
@ IN SOA mail.gjyonline.com. server.gjyonline.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H) ; minimum
NS mail
MX 10 mail //注意用简写后不能打乱前后顺序
mail A 172.16.1.250
pop3 CNAME mail
www CNAME mail
smtp CNAME mail
[root@mailnamed]# cat 1.16.172.local
$TTL72H
@ IN SOA mail.gjyonline.com. server.gjyonline.com. (
1 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H) ; minimum
NS mail.gjyonline.com.
250 PTR mail.gjyonline.com.
[root@mailnamed]# service named start
Startingnamed: [ OK ]
[root@mailnamed]# service named status
version:9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1
CPUsfound: 1
workerthreads: 1
numberof zones: 8
debuglevel: 0
xfersrunning: 0
xfersdeferred: 0
soaqueries in progress: 0
querylogging is OFF
recursiveclients: 0/0/1000
tcpclients: 0/100
serveris up and running
named(pid 27160) is running...
[root@mailnamed]# netstat -tunlp | grep named
tcp 0 0 172.16.1.250:53 0.0.0.0:* LISTEN 27160/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 27160/named
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 27160/named
udp 0 0 172.16.1.250:53 0.0.0.0:* 27160/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 27160/named
看起来,named运行起来表面是没有问题了。
下面就来测试一下named:
[root@mailnamed]# dig -t mx gjyonline.com
;<<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> -tmx gjyonline.com
;;global options: +cmd
;;Got answer:
;;->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59977
;;flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;;WARNING: recursion requested but not available
;;QUESTION SECTION:
;gjyonline.com. IN MX
;;ANSWER SECTION:
gjyonline.com. 259200 IN MX 10 mail.gjyonline.com.
;;AUTHORITY SECTION:
gjyonline.com. 259200 IN NS mail.gjyonline.com.
;;ADDITIONAL SECTION:
mail.gjyonline.com. 259200 IN A 172.16.1.250
;;Query time: 2 msec
;;SERVER: 172.16.1.250#53(172.16.1.250) //指向这个地址正确
;;WHEN: Fri Jan 24 21:02:11 2014
;;MSG SIZE rcvd: 82
很好,这个内网用来测试的DNS服务器正常工作!
在这里有个配置说一下,在/etc/named.conf中,有一行是:include"/etc/named.rfc1912.zones";
如果不想用这个named.rfc1912.zones文件名字,想起个性名字,
比如:include"/etc/named.zones";那么named.zones这个文件就不能放在/etc/目录下,必须要放在/var/named/chroot/etc/named目录下面,否则提示不能正常工作。
如果named不能启动,试着将cp-p /var/named/named.* chroot/var/named/
如果named不能启动,试着看看/var/named/chroot/var/named/下的文件的组属性是不是named的,如果不是,用chgrp -R /var/named/chroot/var/named修改
开启named随机启动:
[root@mailnamed]# chkconfig named --list
named 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@mailnamed]# chkconfig named on
[root@mailnamed]# chkconfig named --list
named 0:off 1:off 2:on 3:on 4:on 5:on 6:off
第七步 启动MySQL数据库,并设置密码
[root@mail~]# service mysqld status
mysqldis stopped
[root@mail~]# service mysqld start
输出略
[root@mail~]# mysql -u root -p
Enterpassword:
输出略
mysql>use mysql
Readingtable information for completion of table and column names
Youcan turn off this feature to get a quicker startup with -A
Databasechanged
mysql>show tables;
+---------------------------+
|Tables_in_mysql |
+---------------------------+
|columns_priv |
|db |
|event |
|func |
|general_log |
|help_category |
|help_keyword |
|help_relation |
|help_topic |
|host |
|ndb_binlog_index |
|plugin |
|proc |
|procs_priv |
|servers |
|slow_log |
|tables_priv |
|time_zone |
|time_zone_leap_second |
|time_zone_name |
|time_zone_transition |
|time_zone_transition_type |
|user |
+---------------------------+
23rows in set (0.00 sec)
mysql>update user set password=password('centos') where user='root'; //密码为centos
QueryOK, 3 rows affected (0.00 sec)
Rowsmatched: 3 Changed: 3 Warnings: 0
mysql>flush privileges;
QueryOK, 0 rows affected (0.00 sec)
mysql>\q
Bye
[root@mail~]# chkconfig mysqld on
第八步 创建新用户
[root@mail~]# useradd -m -d /home/vmail -s /sbin/nologin vmail
[root@mail~]# id vmail
uid=501(vmail)gid=501(vmail) groups=501(vmail)
第九步 启动postfix并测试本地邮件系统
[root@mail~]# service postfix status
master(pid 2480) is running...
[root@mail~]# service postfix stop
Shuttingdown postfix: [ OK ]
[root@mail~]# chkconfig postfix --list
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@mail~]# service postfix restart
Shuttingdown postfix: [FAILED]
Startingpostfix: [ OK ]
[root@mail~]# netstat -tunlp | grep 25
tcp 0 0 172.16.1.250:53 0.0.0.0:* LISTEN 27452/named
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 27999/master
tcp 0 0 :::42625 :::* LISTEN 1935/rpc.statd
tcp 0 0 :::5989 :::* LISTEN 2562/cimserver
tcp 0 0 ::1:25 :::* LISTEN 27999/master
udp 0 0 172.16.1.250:53 0.0.0.0:* 27452/named
如果没开服务,就用service postfix restart打开;如果没随机启动,就用chkconfig postfix on。
注意到这段:127.0.0.1:25,只侦听本机127.0.0.1上的SMTP服务,其它地址形式不认。
测试下:
[root@mail~]# telnet 127.0.0.1 25
Trying127.0.0.1...
Connectedto localhost (127.0.0.1).
Escapecharacter is '^]'.
220mail.gjyonline.com ESMTP Postfix
helo mail.gjyonline.com
250mail.gjyonline.com
mail from:vmail@localhost
2502.1.0 Ok
rcpt to:root@localhost
2502.1.5 Ok
data
354End data with <CR><LF>.<CR><LF>
Hello.
.
2502.0.0 Ok: queued as 62BBEC76CC
quit
2212.0.0 Bye
Connectionclosed by foreign host.
Youhave new mail in /var/spool/mail/root
[root@mail~]# mail
HeirloomMail version 12.4 7/29/08. Type ? forhelp.
"/var/spool/mail/root":1 message 1 new
>N 1 [email protected] Fri Jan 24 21:34 14/532
&1
Message 1:
[email protected] Fri Jan 2421:34:39 2014
Return-Path:<[email protected]>
X-Original-To:root@localhost
Delivered-To:[email protected]
Date:Fri, 24 Jan 2014 21:34:21 +0800 (HKT)
From:[email protected]
To:undisclosed-recipients:;
Status:R
Hello.
&quit
可以看到,它的发信人是:[email protected]这样的形式。
没有配置过的postfix只能认localhost。
第十步 编辑postfix配置文件
[root@mail~]# vi /etc/postfix/main.cf
75 myhostname = mail.gjyonline.com 修改为主机名
83 mydomain = gjyonline.com
99 myorigin = $mydomain
113 inet_interfaces = all
114 #inet_interfaces = $myhostname
115 #inet_interfaces = $myhostname,localhost
116 #inet_interfaces = localhost //一定要注释掉这一行,否则在后面用netstat -tunlp | grep 25 时只会出现127.0.0.1:25,而不是0.0.0.0:25
119 inet_protocols = ipv4
164 #mydestination = $myhostname,localhost.$mydomain, localhost
165 mydestination = $myhostname,localhost.$mydomain, localhost, $mydomain
164注释掉,165不要注释
249 #mynetworks_style = class
250 mynetworks_style = subnet
251 #mynetworks_style = host
264 mynetworks = 172.16.0.0/16, 127.0.0.0/8
[root@mail~]# service postfix restart
Shuttingdown postfix: [ OK ]
Startingpostfix: [ OK ]
第十一步 为postfix开启Cyrus-sasl认证
1、查看postfix支持的SASL认证形式有哪些
[root@mail~]# postconf -a
cyrus 支持cyrus认证
dovecot
2、编辑/etc/postfix/main.cf文件,在最后加入以下内容:
############################ CYRUS-SASL################################
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated , reject_invalid_hostname ,reject_non_fqdn_hostname , reject_unknown_sender_domain ,reject_non_fqdn_sender , reject_non_fqdn_recipient ,reject_unknown_recipient_domain , reject_unauth_pipelining , reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options =noanonymous
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
3、配置sasl的文件
[root@mail~]# cd /usr/lib/sasl2/
[root@mailsasl2]# vim smtpd.conf
在这个smtpd.conf文件中先写这两行内容,没有就自己动手创建smtpd.conf:
[root@mailsasl2]# cat smtpd.conf
pwcheck_method:saslauthd
mech_list:PLAINLOGIN
4、开启服务并随机启动
[root@mailsasl2]# service saslauthd status
saslauthdis stopped
[root@mailsasl2]# service saslauthd start 开启saslauthd服务
Startingsaslauthd: [ OK ]
[root@mailsasl2]# chkconfig saslauthd on 随机启动
5、重新加载postfix
[root@mailsasl2]# service postfix restart
Shuttingdown postfix: [ OK ]
Startingpostfix: [ OK ]
6、验证postfix是否加入sasl认证服务
[root@mail ~]# netstat -tunlp | grep 25
tcp 0 0 172.16.1.250:53 0.0.0.0:* LISTEN 27452/named
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 29135/master 代表侦听任意网段的SMTP信息,不仅仅是127.0.0.1了
tcp 0 0 :::42625 :::* LISTEN 1935/rpc.statd
tcp 0 0 :::5989 :::* LISTEN 2562/cimserver
udp 0 0 172.16.1.250:53 0.0.0.0:* 27452/named
[root@mail ~]# telnetmail.gjyonline.com 25
Trying 172.16.1.250...
Connected to mail.gjyonline.com(172.16.1.250).
Escape character is '^]'.
220 Welcome to our mail.gjyonline.com ESMTP,Warning: Version not Available!
ehlo mail.gjyonline.com 注意,这里用ehlo,不是helo,helo不支持saslauthd认证服务,只有ehlo,即增强的helo版本才能识别saslauthd服务
250-mail.gjyonline.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN 这两红色句子代表postfix成功启用saslauthd认证服务
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:[email protected] 因为可以侦听任意网段的,所以就用gjyonline.com
250 2.1.0 Ok
rcpt to:[email protected]
250 2.1.5 Ok
data
354 End data with<CR><LF>.<CR><LF>
12347890
.
250 2.0.0 Ok: queued as AB85BC76CF
quit
221 2.0.0 Bye
Connection closed by foreign host.
You have new mail in/var/spool/mail/root
[root@mail ~]# mail
Heirloom Mail version 12.47/29/08. Type ? for help.
"/var/spool/mail/root": 1message 1 new
>N 1 [email protected] Fri Jan 24 23:42 14/515 可以正常收发信件
& 1
Message 1:
From [email protected] Fri Jan 24 23:42:17 2014
Return-Path:<[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Date: Fri, 24 Jan 2014 23:42:04 +0800(HKT)
From: [email protected]
To: undisclosed-recipients:;
Status: R
12347890
& quit
Held 1 message in /var/spool/mail/root
[root@mail~]#
第十二步 安装Courier Authtication Library库文件
1、安装 Courier authentication library 是让 postfix 够和 mysql 数据库连接,将用户的帐号和密码放在数据库中,以便能够提供用户认证
[root@mail 123]# tar jxfcourier-authlib-0.66.1.tar.bz2 -C /usr/local/src/
[root@mail 123]# cd /usr/local/src/ ;ll
total 8
drwxr-xr-x. 5 1000 1000 4096 Nov 1206:39 courier-authlib-0.66.1
drwxr-xr-x. 7 root root 4096 Nov 1 2012vmware-tools-distrib
[root@mail src]# cdcourier-authlib-0.66.1/
[[email protected]]#./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc--with-authmysql --with-mysql-libs=/usr/lib/mysql--with-mysql-includes=/usr/include/mysql --with-redhat--with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc
[[email protected]]# make
[[email protected]]# make install
make[4]:Leaving directory `/usr/local/src/courier-authlib-0.66.1'
make[3]:Leaving directory `/usr/local/src/courier-authlib-0.66.1'
make[2]:Leaving directory `/usr/local/src/courier-authlib-0.66.1'
make[1]:Leaving directory `/usr/local/src/courier-authlib-0.66.1'
但最后报了这四个leaving directory,好像是子shell退出某个目录。不管了,继续往下。
[root@mailspool]# pwd
/usr/local/courier-authlib/var/spool
[root@mailspool]# ll
total4
drwxr-x---.2 daemon daemon 4096 Jan 25 01:40 authdaemon
[root@mailspool]# chmod 755 authdaemon/
[root@mailspool]# ll
total4
drwxr-xr-x.2 daemon daemon 4096 Jan 25 01:40 authdaemon
[root@mailspool]# cd
[root@mail~]# cp -p /etc/authmysqlrc.dist /etc/authmysqlrc
[root@mail~]# cp -p /etc/authdaemonrc.dist /etc/authdaemonrc
2、修改/etc/authdaemonrc文件
27 authmodulelist="authmysql"
34authmodulelistorig="authmysql"
53 daemons=10
3、修改/etc/authmysqlrc文件
[root@mail~]# vi /etc/authmysqlrc
26 MYSQL_SERVER localhost
27 MYSQL_USERNAME extmail
28 MYSQL_PASSWORD extmail
56 MYSQL_PORT 3306
68 MYSQL_DATABASE extmail
83 MYSQL_USER_TABLE mailbox
92 MYSQL_CRYPT_PWFIELD password
113 MYSQL_UID_FIELD 501
119 MYSQL_GID_FIELD 501
128 MYSQL_LOGIN_FIELD username
133 MYSQL_HOME_FIELD concat('/var/mailbox/',homedir)
150 MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir)
4、将courier-authlib加入系统启动队列
[root@mail~]# cd /usr/local/src/courier-authlib-0.66.1/
[[email protected]]# cp courier-authlib.sysvinit/etc/init.d/courier-authlib
[[email protected]]# ll /etc/init.d/courier-authlib
-rw-r--r--.1 root root 943 Jan 25 02:10 /etc/init.d/courier-authlib
[[email protected]]# chmod 755 /etc/init.d/courier-authlib
[[email protected]]# service courier-authlib restart
StoppingCourier authentication services: authdaemond
StartingCourier authentication services: authdaemond
[[email protected]]# chkconfig --add courier-authlib
[root@mail courier-authlib-0.66.1]#echo "/usr/local/courier-authlib/lib/courier-authlib" >>/etc/ld.so.conf.d/courier-authlib.conf
[[email protected]]# ldconfig -v 重新加载库文件
5、新建虚拟用户邮箱所在的目录,并将其权限赋予vmail 用户
[[email protected]]# mkdir -pv /var/mailbox
mkdir:created directory `/var/mailbox'
[[email protected]]# chown -R vmail.vmail /var/mailbox/
[[email protected]]# ll -d /var/mailbox
drwxr-xr-x.2 vmail vmail 4096 Jan 25 02:17 /var/mailbox
6、重新配置saslauthd认证
[[email protected]]# vi /usr/lib/sasl2/smtpd.conf
1 #pwcheck_method:saslauthd
2 #mech_list:PLAIN LOGIN 原来的两行注释
3 pwcheck_method:authdaemond
4 log_level: 3
5 mech_list:PLAIN LOGIN
6 authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket
第十三步 让postfix支持虚拟域和虚拟用户
1、再次配置postfix的main.cf文件
[[email protected]]# vi /etc/postfix/main.cf
在最后加入:
691 ######################## VirtualMailbox Settings ########################
692
693 virtual_mailbox_base = /var/mailbox
694
695 virtual_mailbox_maps =mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
696
697 virtual_mailbox_domains =mysql:/etc/postfix/mysql_virtual_domains_maps.cf
698
699 virtual_alias_domains =
700
701 virtual_alias_maps =mysql:/etc/postfix/mysql_virtual_alias_maps.cf
702
703 virtual_uid_maps = static:501
704
705 virtual_gid_maps = static:501
706
707 virtual_transport = virtual
708
709 maildrop_destination_recipient_limit =1
710
711 maildrop_destination_concurrency_limit= 1
712
713 ########################## QUOTASettings ##############################
714
715 message_size_limit = 14336000
716
717 virtual_mailbox_limit = 20971520
718
719 virtual_create_maildirsize = yes
720
721 virtual_mailbox_extended = yes
722
723 virtual_mailbox_limit_maps =mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
724
725 virtual_mailbox_limit_override = yes
726
727 virtual_maildir_limit_message =Sorry,the user's maildir has overdrawn his diskspace quota, please Tidy yourmailbox and try again later.
728
729 virtual_overquota_bounce = yes
2、使用 extman 源码目录下 docs 目录中的 extmail.sql 和 init.sql 建立数据库
[root@mail123]# tar zxf extman-1.1.tar.gz -C /usr/local/src
[root@mail123]# cd /usr/local/src/extman-1.1/
[[email protected]]# cd docs/
[root@maildocs]# mysql -u root -pcentos < extmail.sql
[root@maildocs]# mysql -u root -pcentos < init.sql
[root@maildocs]# mysql -u root -pcentos
输出略
mysql>show databases;
+--------------------+
|Database |
+--------------------+
|information_schema |
| extmail | 建立了新的数据库
|mysql |
|test |
+--------------------+
4rows in set (0.00 sec)
mysql>use extmail;
Readingtable information for completion of table and column names
Youcan turn off this feature to get a quicker startup with -A
Databasechanged
mysql>show tables;
+-------------------+
|Tables_in_extmail |
+-------------------+
|alias |
|domain |
|domain_manager |
| mailbox | 建立了新的数据表
|manager |
+-------------------+
5rows in set (0.00 sec)
mysql>\q
Bye
[root@maildocs]# pwd
/usr/local/src/extman-1.1/docs
[root@maildocs]# cp ./mysql* /etc/postfix/
3、授予用户extmail访问extmail数据库的权限
[root@maildocs]# mysql -u root -pcentos
Welcometo the MySQL monitor. Commands end with; or \g.
YourMySQL connection id is 7
Serverversion: 5.1.71 Source distribution
Copyright(c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracleis a registered trademark of Oracle Corporation and/or its
affiliates.Other names may be trademarks of their respective
owners.
Type'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>GRANT all privileges on extmail.* to extmail@localhost IDENTIFIED BY 'extmail';
QueryOK, 0 rows affected (0.00 sec)
mysql>GRANT all privileges on extmail.* TO [email protected] IDENTIFIED BY 'extmail';
QueryOK, 0 rows affected (0.00 sec)
mysql>flush privileges;
QueryOK, 0 rows affected (0.00 sec)
mysql>\q
Bye
[root@maildocs]# service postfix restart
Shuttingdown postfix: [ OK ]
Startingpostfix: [ OK ]
第十四步 配置dovecot
1、配置dovecot主文件
[root@maildocs]# vi /etc/dovecot/dovecot.conf
20 protocols = imap pop3 lmtp
26 listen = *
38 disable_plaintext_auth = no
[root@mail~]# vi /etc/dovecot/conf.d/10-mail.conf
27 mail_location =maildir:/var/mailbox/%d/%n/Maildir
2、配置dovecot和MySQL文件
[[email protected]]# cp auth-sql.conf.ext ./auth-sql.conf
[[email protected]]# vi auth-sql.conf
5 passdb {
6 driver = sql
7
8 # Path for SQL configuration file, seeexample-config/dovecot-sql.conf.ext
9 args = /etc/dovecot-mysql.conf
10 }
19 userdb {
20 driver = sql
21 args = /etc/dovecot-mysql.conf
22 }
3、配置MySQL驱动文件
[[email protected]]# vi /etc/dovecot-mysql.conf
1 driver = mysql
2
3 connect = host=localhost dbname=extmailuser=extmail password=extmail
4
5 default_pass_scheme = CRYPT
6
7 password_query = SELECT username ASuser,password AS password FROM mailbox WHERE username='%u'
8
9 user_query = SELECT maildir,uidnumberAS uid,gidnumber AS gid FROM mailbox WHERE username='%u'
4、把userdb的其它相关禁用
[root@mail~]# vi /etc/postfix/main.cf
419 home_mailbox = Maildir/
5、启动dovecot服务
[root@mail~]# service dovecot status
dovecotis stopped
[root@mail~]# service dovecot start
StartingDovecot Imap: [ OK ]
[root@mail~]# chkconfig dovecot on
[root@mail~]# service postfix restart
Shuttingdown postfix: [ OK ]
Startingpostfix: [ OK ]
第十五步 安装Extmail-1.2
1、建立Extmail和Extman的目录
[root@mail~]# mkdir -pv /var/www/extsuite
mkdir:created directory `/var/www/extsuite'
2、安装 Extmail-1.2
[root@mail123]# ll
total8752
-rwxrw-rw-.1 root root 2299965 Jan 21 09:02 courier-authlib-0.66.1.tar.bz2
-rwxrw-rw-.1 root root 541279 Jan 23 15:13extmail-1.2.tar.gz
-rwxrw-rw-.1 root root 586234 Aug 9 03:01 extman-1.1.tar.gz
-rwxrw-rw-.1 root root 22800 Aug 9 03:17 File-Tail-0.99.3.tar.gz
-rwxrw-rw-.1 root root 210288 Jan 19 12:09perl-GD-2.45-1.el6.rfx.i686.rpm
-rwxrw-rw-.1 root root 3827595 Aug 9 02:05postfix-2.10.1.tar.gz
-rwxrw-rw-.1 root root 1349040 Aug 9 03:18rrdtool-1.4.7.tar.gz
-rwxrw-rw-.1 root root 87541 Aug 9 03:16 Time-HiRes-1.9719.tar.gz
-rwxrw-rw-.1 root root 13738 Aug 9 03:09 Unix-Syslog-1.1.tar.gz
[root@mail123]# tar zxf extmail-1.2.tar.gz -C /usr/local/src
[root@mail123]# cd /usr/local/src
[root@mailsrc]# mv extmail-1.2/ /var/www/extsuite/extmail
[root@mailextsuite]# cd /root/Desktop/123/
[root@mail123]# tar zxf extman-1.1.tar.gz -C /usr/local/src
[root@mail123]# cd /usr/local/src
[root@mailsrc]# mv extman-1.1/ /var/www/extsuite/extman
[root@mailsrc]# cd /var/www/extsuite/
3、修改extmail配置文件
[root@mailextsuite]# ll
total8
drwxr-xr-x. 7 xguest xguest 4096 Dec 25 2009 extmail //这里的用户和组都必须要改
drwxr-xr-x.11 xguest xguest 4096 Dec 24 2009 extman
[root@mailextsuite]# cd extmail/
[root@mailextmail]# cp webmail.cf.default webmail.cf
77 SYS_USER_LANG = zh_CN
104 SYS_MESSAGE_SIZE_LIMIT = 5242880 //默认用5MB
127 SYS_MAILDIR_BASE = /var/mailbox
139 SYS_MYSQL_USER = extmail
140 SYS_MYSQL_PASS = extmail
141 SYS_MYSQL_DB = extmail
142 SYS_MYSQL_HOST = localhost
144 # table name
145 SYS_MYSQL_TABLE = mailbox
146 SYS_MYSQL_ATTR_USERNAME = username
147 SYS_MYSQL_ATTR_DOMAIN = domain
148 SYS_MYSQL_ATTR_PASSWD = password //以上4项就用table name默认值
197 SYS_AUTHLIB_SOCKET =/usr/local/courier-authlib/var/spool/authdaemon/socket
[root@mail extmail]# service httpdstatus
httpd is stopped
[root@mail extmail]# service httpdstart
Starting httpd: [ OK ]
[root@mail extmail]# chkconfig httpd on
4、apache 相关配置
[root@mail extmail]# vi/etc/httpd/conf/httpd.conf
242 User vmail
243 Group vmail
在最后加入:
1011 <VirtualHost 172.16.1.250:80>
1012 ServerNamemail.gjyonline.com
1013 DocumentRoot/var/www/extsuite/extmail/html/
1014 ScriptAlias/extmail/cgi /var/www/extsuite/extmail/cgi
1015 Alias /extmail /var/www/extsuite/extmail/html
1016 </VirtualHost>
5、修改/var/www/extsuite 的属主和组用户
[root@mail extmail]# chown -Rvmail.vmail /var/www/extsuite/
[root@mail extmail]# ll/var/www/extsuite/
total 8
drwxr-xr-x. 7 vmail vmail 4096 Jan 25 21:26 extmail
drwxr-xr-x. 11 vmail vmail 4096 Dec24 2009 extman
[root@mail extmail]# service httpdrestart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
6、依赖关系的解决,编译安装 Unix-Syslog-0.100.tar.gz
[root@mail extmail]# cd/root/Desktop/123/
[root@mail 123]# ll
total 8752
-rwxrw-rw-. 1 root root 2299965 Jan 2109:02 courier-authlib-0.66.1.tar.bz2
-rwxrw-rw-. 1 root root 541279 Jan 23 15:13 extmail-1.2.tar.gz
-rwxrw-rw-. 1 root root 586234 Aug 9 03:01 extman-1.1.tar.gz
-rwxrw-rw-. 1 root root 22800 Aug 9 03:17 File-Tail-0.99.3.tar.gz
-rwxrw-rw-. 1 root root 210288 Jan 19 12:09perl-GD-2.45-1.el6.rfx.i686.rpm
-rwxrw-rw-. 1 root root 3827595Aug 9 02:05 postfix-2.10.1.tar.gz
-rwxrw-rw-. 1 root root 1349040Aug 9 03:18 rrdtool-1.4.7.tar.gz
-rwxrw-rw-. 1 root root 87541 Aug 9 03:16 Time-HiRes-1.9719.tar.gz
-rwxrw-rw-. 1 root root 13738 Aug 9 03:09 Unix-Syslog-1.1.tar.gz
[root@mail 123]# tar zxfUnix-Syslog-1.1.tar.gz -C /usr/local/src
[root@mail 123]# cd /usr/local/src; ll
total 20
drwxr-xr-x. 7 root root 12288 Jan 2501:40 courier-authlib-0.66.1
drwxr-xr-x. 2 1001 bin 4096 May 19 2008 Unix-Syslog-1.1
drwxr-xr-x. 7 root root 4096 Nov 1 2012 vmware-tools-distrib
[root@mail src]# cd Unix-Syslog-1.1/
[root@mail Unix-Syslog-1.1]# ll
total 60
-rw-r--r--. 1 1001 bin 8902 Oct 3 2007Artistic
-rw-r--r--. 1 1001 bin 3659 May 19 2008 Changes
-rw-r--r--. 1 1001 bin 463 May 19 2008 Makefile.PL
-rw-r--r--. 1 1001 bin 152 May 19 2008 MANIFEST
-rw-r--r--. 1 1001 bin 296 May 19 2008 META.yml
-rw-r--r--. 1 1001 bin 5642 Oct 3 2007README
-rw-r--r--. 1 1001 bin 9287 May 19 2008 Syslog.pm
-rw-r--r--. 1 1001 bin 3928 May 18 2008 Syslog.xs
-rw-r--r--. 1 1001 bin 7108 Feb 28 2008 test.pl
[root@mail Unix-Syslog-1.1]# perlMakefile.PL
[root@mail Unix-Syslog-1.1]# make&& make install
7、重启httpd服务
[root@mail Unix-Syslog-1.1]# servicehttpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
8、IE浏览器访问http://172.16.1.250/extmail或者
http://mail.gjyonline.com却不能访问正常的网页
我擦,在查了vi /var/log/httpd/error_log这个文件后,发现有大量的错误提示:
[TueJan 21 02:17:39 2014] [error] NSS_Initialize failed. Certificate database:/etc/httpd/alias.
[TueJan 21 02:17:39 2014] [error] SSL Library Error: -8038SEC_ERROR_NOT_INITIALIZED
最后在查网络知道答案:
chgrpvmail /etc/httpd/alias/*.db //改成vmail的组就行!
就是这样就可以了!
9、可以正常打开网页了:
点击“登录邮箱管理”,输入用户名:[email protected],密码:extmail*123*,点击“登录”,
提示404错误。
第十六步 配置Extman
1、Extman已经安装到/var/www/extmail
[root@mailsrc]# cd /var/www/extsuite/
[root@mailextsuite]# ll
total8
drwxr-xr-x. 7 vmail vmail 4096 Jan 25 21:26 extmail
drwxr-xr-x.11 vmail vmail 4096 Dec 24 2009 extman
2、修改Extman的配置文件
[root@mailextsuite]# cd extman/
[root@mailextman]# ll
total100
drwxr-xr-x.3 vmail vmail 4096 May 3 2009addon
-rw-r--r--.1 vmail vmail 140 Oct 22 2005 AUTHORS
drwxr-xr-x.2 vmail vmail 4096 May 9 2009cgi
-rw-r--r--.1 vmail vmail 20812 Dec 24 2009ChangeLog
drwxr-xr-x.2 vmail vmail 4096 Dec 24 2009 contrib
drwxr-xr-x.3 vmail vmail 4096 Dec 24 2009 daemon
drwxr-xr-x.2 vmail vmail 4096 Nov 7 2009docs
drwxr-xr-x.5 vmail vmail 4096 Dec 24 2009 html
-rw-r--r--.1 vmail vmail 3860 Feb 13 2007 INSTALL
drwxr-xr-x.2 vmail vmail 4096 Nov 8 2009lang
drwxr-xr-x.6 vmail vmail 4096 Jul 20 2009 libs
-rw-r--r--.1 vmail vmail 2112 Mar 6 2007README
-rw-r--r--.1 vmail vmail 13723 Sep 25 2008README.fcgi
drwxr-xr-x.2 vmail vmail 4096 Dec 24 2009 tools
-rw-r--r--.1 vmail vmail 4 Dec 24 2009 Version
-rw-r--r--.1 vmail vmail 5046 Nov 8 2009webman.cf.default
[root@mailextman]# cp -p webman.cf.default webman.cf
[root@mailextman]# vi webman.cf
12 SYS_MAILDIR_BASE = /var/mailbox
21 SYS_CAPTCHA_ON = 0 //验证码,后面会重点提到这个
39 SYS_LANG = zh_CN
3、再次修改/var/www/extsuite属性
[root@mailextman]# chown -R vmail.vmail/var/www/extsuite
4、编辑 apache 的主配置文件
[root@mailextman]# vi /etc/httpd/conf/httpd.conf
1011 <VirtualHost 172.16.1.250:80>
1012 ServerName mail.gjyonline.com
1013 DocumentRoot /var/www/extsuite/extmail/html/
1014 ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
1015 Alias /extmail /var/www/extsuite/extmail/html
1016 ScriptAlias /extman/cgi/var/www/extsuite/extman/cgi
1017 Alias /extman/var/www/extsuite/extman/html
1018 </VirtualHost>
在原来基础上添加红色字体部分。
在这里重点提一下:
在/etc/httpd/conf/httpd.conf中,不要用suexecusergroup,而要用User vmail、Group vmail来写:
用suexecusergroup就要注释掉User 、Group这现行,即:
#Uservmail
#Groupvmail
<VirtualHost172.16.1.2:80>
ServerName mail.postfix.org
DocumentRoot/var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi/var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
ScriptAlias /extman/cgi/var/www/extsuite/extman/cgi
Alias /extman/var/www/extsuite/extman/html
SuexecUserGroup vmailvmail 用这一行就无法启动extmail界面,听说是多少号以下的uid和gid才不能用,没试
</VirtualHost>
5、创建其运行时所需的临时目录,并修改其相应的权限
[root@mailextman]# mkdir -pv /tmp/extman
mkdir:created directory `/tmp/extman'
[root@mailextman]# chown -R vmail.vmail /tmp/extman/
6、重启httpd服务
[root@mailextman]# service httpd restart
Stoppinghttpd: [ OK ]
Startinghttpd: [ OK ]
7、重新登录Extman
看到一片空白,好的,现在配置图形界面
[root@mail123]# tar zxf Time-HiRes-1.9719.tar.gz -C /usr/local/src
[root@mail123]# tar zxf File-Tail-0.99.3.tar.gz -C/usr/local/src
[root@mail123]# tar zxf rrdtool-1.4.7.tar.gz -C /usr/local/src
[root@mail123]# cd /usr/local/src
[root@mailsrc]# cd Time-HiRes-1.9719/
注意安装顺序不能改换
第一:
[[email protected]]# perl Makefile.PL
[[email protected]]# make
[[email protected]]# make test
[[email protected]]# make install
第二:
[root@mailsrc]# cd File-Tail-0.99.3/
[[email protected]]# perl Makefile.PL
[[email protected]]# make
[[email protected]]# make test
[[email protected]]# make install
第三:
[[email protected]]# ./configure --prefix=/usr/local/rrdtool
[[email protected]]# make && make install
8、创建必要的符号链接(Extman 会到这些路径下找相关的库文件)
[root@mail ~]# ln -sv/usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-multi/auto/RRDs /usr/lib/perl5/5.10.0/i386-linux-thread-multi/
`/usr/lib/perl5/5.10.0/i386-linux-thread-multi/RRDs'-> `/usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-multi/auto/RRDs'
[root@mail ~]# ln -sv/usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-multi/RRDs.pm/usr/lib/perl5/5.10.0/
`/usr/lib/perl5/5.10.0/RRDs.pm' ->`/usr/local/rrdtool/lib/perl/5.10.1/i386-linux-thread-multi/RRDs.pm'
[root@mail ~]# ln -sv/usr/local/rrdtool/lib/perl/5.10.1/RRDp.pm /usr/lib/perl5/5.10.0/
`/usr/lib/perl5/5.10.0/RRDp.pm' ->`/usr/local/rrdtool/lib/perl/5.10.1/RRDp.pm'
9、复制mailgraph_ext到/usr/local,并启动
[root@mail rrdtool-1.4.7]# cp -r/var/www/extsuite/extman/addon/mailgraph_ext/ /usr/local/
[root@mail rrdtool-1.4.7]#/usr/local/mailgraph_ext/mailgraph-init start
Starting mail statistics grapher:mailgraph_ext
Starting queue statistics grapher:qmonitor
[root@mailDesktop]# service httpd restart
Stoppinghttpd: [ OK ]
Startinghttpd: [ OK ]
10、启动 cmdserver(在后台显示系统信息)
[root@mailrrdtool]# /var/www/extsuite/extman/daemon/cmdserver --daemon
loadedok
11、添加到自动启动队列
[root@mail rrdtool]# echo"/usr/local/mailgraph_ext/mailgraph-init start" >>/etc/rc.d/rc.local
[root@mail rrdtool]# echo "/var/www/extsuite/extman/daemon/cmdserver-v -d" >> /etc/rc.d/rc.local
[root@mailrrdtool]# cat /etc/rc.d/rc.local
#!/bin/sh
#
#This script will be executed *after* all the other init scripts.
#You can put your own initialization stuff in here if you don't
#want to do the full Sys V style init stuff.
touch/var/lock/subsys/local
/usr/local/mailgraph_ext/mailgraph-initstart
/var/www/extsuite/extman/daemon/cmdserver-v -d
11、加入验证码机制
[root@mail123]# rpm -ivh perl-GD-2.45-1.el6.rfx.i686.rpm
warning:perl-GD-2.45-1.el6.rfx.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6:NOKEY
Preparing... ########################################### [100%]
1:perl-GD ########################################### [100%]
注意,有的校验码插件不区分大小写,但perl-GD是区分大小写的!
12、安装rrdtool相关perl包
[root@mail~]# rpm -qa | grep rrdtool
rrdtool-perl-1.4.7-1.wrl.i386
rrdtool-devel-1.4.7-1.wrl.i386
rrdtool-1.4.7-1.wrl.i386
13、Jan 19 22:03:32localhost postfix/trivial-rewrite[2307]: warning: do not list domain gjyonline.comin BOTH mydestination and virtual_mailbox_domains这一行是启用虚拟域以后,需要取消中心域,即注释掉/etc/postfix/main.cf 中的 mydestination =$myhostname, localhost.$mydomain,
localhost,$mydomain
[root@mail~]# vi /etc/postfix/main.cf
164 #mydestination = $myhostname, localhost.$mydomain,localhost
165 #mydestination = $myhostname,localhost.$mydomain, localhost, $mydomain
166 #mydestination = $myhostname,localhost.$mydomain, localhost, $mydomain,
167 # mail.$mydomain, www.$mydomain, ftp.$mydomain
[root@mail~]# service postfix restart
Shuttingdown postfix: [ OK ]
Startingpostfix: [ OK ]
[root@mail~]# service httpd restart
Stoppinghttpd: [ OK ]
Startinghttpd: [ OK ]
对:bad uid 89 in virtual_uid_maps 该问题的最好解答:
重新建了一个用户及组,将main.cf authmysqlrc里的ID改成新建用户的ID号,
再将apache下的httpd.conf里的user group改为新的。
最主要是要把整个mailbox目录及子目录属主及属组改成新建的用户及组,chown -Rusername. groupname mailbox/
我的已经可以完美收发了。祝您好运!!!
这里也补充一下,还必须把extman所在目录也改成新用户和属组一样的目录,否则permit deny。
[root@mailnamed]# service named start
Generating/etc/rndc.key: 停这不动
使用这条命令:
[root@mailnamed]# rndc-confgen -r /dev/urandom -a
最后有个BUG说下:
我在虚拟机上试过centos6.5 32bit、centos6.5 64bit、centos5.8 32bit、centos5.8 64bit、centos5.6 64bit安装过postfix+mysql+extmail,没有问题;但Dell R210(2代)上安装centos6.5 64bit+postfix+mysql+extmail完后一小段时间,就会出现提示:(具体英文忘了)有另外一个Unix进程在占用mysql.sock。而且mysqld已经关闭(正常情况下,mysqld关闭后会删除mysql.sock文件),可以通过手工删除/var/lib/mysql/mysql.sock,并重启mysqld来临时解决这个问题,但后面过一会仍会反复出现这个问题,后面换了centos6.532bit也会出现同样问题,最后没办法,换一台普通台式机装centos6.532bit+postfix+mysql+extmail就没有问题,建议大家不要再升级现有MySQL版本。
高建勇/steve nash