◆运行环境:Centos5
◆所需软件:
httpd-2.2.0.tar.gz,
mysql-5.0.41.tar.gz,
php-5.2.3.tar.gz,
courier-authlib-0.59.3.tar.bz2,
courier-imap-4.5.0.tar.bz2,
cyrus-sasl-2.1.23.tar.gz
postfixadmin-2.1.0.gz
postfix-2.4.9.tar.gz
pcre-7.2.tar.gz
maildrop-2.5.tar.bz2
◆准备工作:
1、卸载相关软件:全新进行postfix与各软件整合。
1/1:rpm -e --nodeps sendmail
1/2:rpm -qa | grep sasl
rpm -e --nodeps cyrus-sasl-* 注: (ls -al /usr/lib | grep sasl) 应该没有目录sasl与sasl2
1/4:rpm -qa | grep perl
yum remove perl 执行完后,运行perl -v 注:(如果出现-bash:perl:command not found"则表明已经把perl清除掉了。
2、创建邮件系统所需的用户与组:
[root@mail1 ~]# groupadd vmail
[root@mail1 ~]# groupadd postfix
[root@mail1 ~]# groupadd postdrop
[root@mail1 ~]# groupadd amavis
[root@mail1 ~]# groupadd clamav
[root@mail1 ~]# groupmod -g 1001 vmail
[root@mail1 ~]# useradd mysql -g mysql
[root@mail1 ~]# usradd vmail -g vmail -u 1001
[root@mail1 ~]# useradd postfix -g postfix
[root@mail1 ~]# useradd amavis -g amavis
3、建立网络环境
[root@mail1 ~]# hostname
mail1.mail.sery.com
[root@mail1 ~]# cat /etc/resolv.conf
nameserver 192.168.20.205
search mail.sery.com
[root@mail1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:50:56:A6:00:0D
ONBOOT=yes
IPADDR=192.168.20.206
NETMASK=255.255.255.0
4、建立DNS服务器,这里只把配置写出来,建立过程不作详细说明:
[root@ben ~]# cat /usr/local/named/etc/named.conf
options {
directory "/data/named";
allow-query-cache {any;};
pid-file "named.pid";
};
key "rndc-key" {
algorithm hmac-md5;
secret "s8sFAwD/KNS8bI9myo27aw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
logging {
channel query_log {
file "query.log" versions 5 size 20m;
severity info;
print-time yes;
print-category yes;
};
category queries {
query_log;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
#zone "formyz.cn" IN {
# type master;
# file "formyz.cn.zone";
# allow-update { none; };
# };
zone "mail.sery.com" IN {
type master;
file "mail.sery.com.zone";
};
zone "20.168.192.in-addr.arpa" {
type master;
file "192.168.0.zone";
};
[root@ben ~]# cat /usr/local/named/etc/rndc.conf
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "s8sFAwD/KNS8bI9myo27aw==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "s8sFAwD/KNS8bI9myo27aw==";
# };
#
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf
[root@ben ~]# cat /data/named/named.ca
;;G 9.3.3rc2 <<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42143
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 14
;; QUESTION SECTION:
;. IN NS
;; ANSWER SECTION:
. 445881 IN NS h.root-servers.net.
. 445881 IN NS i.root-servers.net.
. 445881 IN NS b.root-servers.net.
. 445881 IN NS d.root-servers.net.
. 445881 IN NS m.root-servers.net.
. 445881 IN NS a.root-servers.net.
. 445881 IN NS l.root-servers.net.
. 445881 IN NS k.root-servers.net.
. 445881 IN NS c.root-servers.net.
. 445881 IN NS e.root-servers.net.
. 445881 IN NS g.root-servers.net.
. 445881 IN NS j.root-servers.net.
. 445881 IN NS f.root-servers.net.
;; ADDITIONAL SECTION:
a.root-servers.net. 3461941 IN A 198.41.0.4
a.root-servers.net. 3532082 IN AAAA 2001:503:ba3e::2:30
b.root-servers.net. 3523625 IN A 192.228.79.201
c.root-servers.net. 3462350 IN A 192.33.4.12
d.root-servers.net. 3462598 IN A 128.8.10.90
d.root-servers.net. 3542767 IN AAAA 2001:500:2d::d
e.root-servers.net. 3462564 IN A 192.203.230.10
f.root-servers.net. 3523443 IN A 192.5.5.241
f.root-servers.net. 3534003 IN AAAA 2001:500:2f::f
g.root-servers.net. 3523452 IN A 192.112.36.4
h.root-servers.net. 3523453 IN A 128.63.2.53
h.root-servers.net. 3553028 IN AAAA 2001:500:1::803f:235
i.root-servers.net. 3523432 IN A 192.36.148.17
i.root-servers.net. 3586381 IN AAAA 2001:7fe::53
;; Query time: 64 msec
;; SERVER: 202.96.104.17#53(202.96.104.17)
;; WHEN: Fri Feb 10 12:48:59 2012
;; MSG SIZE rcvd: 512
[root@ben ~]# cat /data/named/named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
2006121601 ;serial (d.adams)
3H ; refresh
15M ; retry
1W ;expiry
1D ) ; minimum
IN NS localhost.
1 IN PTR localhost
[root@ben ~]# cat /data/named/localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d.adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
[root@ben ~]# cat /data/named/mail.sery.com.zone
$TTL 1D
@ IN SOA ben.mail.sery.com. root.mail.sery.com. (
2009071966 ; serial
3H ;
15M ;
1W ;
1D ) ;
@ IN NS ben.mail.sery.com.
ben IN A 192.168.20.205
mail1 IN A 192.168.20.206
mail2 IN A 192.168.20.204
mail.sery.com. IN MX 20 mail1.mail.sery.com.
mail.sery.com. IN MX 30 mail2.mail.sery.com.
benson-PC IN A 192.168.10.115
[root@ben ~]# cat /data/named/192.168.0.zone
$TTL 86400
@ IN SOA ben.mail.sery.com. root.mail.sery.com. (
42 ; serial (d.adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS ben.mail.sery.com.
205 IN PTR ben.mail.sery.com.
204 IN PTR mail2.mail.sery.com.
206 IN PTR mail1.mail.sery.com.
115 IN PTR benson-PC.mail.sery.com.
[root@ben ~]# nslookup
> 192.168.20.206
Server: 192.168.20.205
Address: 192.168.20.205#53
206.20.168.192.in-addr.arpa name = mail1.mail.sery.com.
> mail1
Server: 192.168.20.205
Address: 192.168.20.205#53
** server can't find mail1: NXDOMAIN
> mail1.mail.sery.com
Server: 192.168.20.205
Address: 192.168.20.205#53
Name: mail1.mail.sery.com
Address: 192.168.20.206
> set type=mx
> mail1
Server: 192.168.20.205
Address: 192.168.20.205#53
** server can't find mail1: NXDOMAIN
> mail.sery.com
Server: 192.168.20.205
Address: 192.168.20.205#53
mail.sery.com mail exchanger = 20 mail1.mail.sery.com.
mail.sery.com mail exchanger = 30 mail2.mail.sery.com.
◆配置过程:LAMP
1、 Apache
yum -y install gcc gcc-c++
tar zxvf httpd-2.2.0.tar.gz
cd httpd-2.2.0
./configure --prefix=/usr/local/apache --enable-so
make
make install
查看静态模块 [root@mail1 ~]# /usr/local/apache/bin/httpd -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_include.c
mod_filter.c
mod_log_config.c
mod_env.c
mod_setenvif.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_negotiation.c
mod_dir.c
mod_actions.c
mod_userdir.c
mod_alias.c
( mod_so.c ) 则表明--enable-so 已经加入到模块中了
查看动态模块:
[root@mail1 ~]# ls -l /usr/local/apache/modules/
total 12224
-rw-r--r-- 1 root root 8873 Feb 16 09:10 httpd.exp
-rwxr-xr-x 1 root root 12485669 Feb 16 10:21 libphp5.so
[root@myest modules]# ll
total 12212
-rw-r--r-- 1 root root 8873 Jul 30 14:55 httpd.exp
-rwxr-xr-x 1 root root 12473318 Jul 31 09:29 libphp5.so
|
vi test.php
<?
phpinfo();
?>
|