主机一ip为192.168.0.100

主机二ip为192.168.0.19

首先在第一主机上搭建dns服务器和MYsql数据库

使用yum install bind*  mysql mysql-server caching-nameserver -y

那种完成以上包后,进入cd /etc/named  rm -rf name* 在删除/var/named/chroot/etc/named*

vim /var/named/chroot/etc/named.conf 进行编写dns的配置文件

options {

        directory    "/var/named";

};

zone "example.com" {

         type    master;

         file    "example.com.zone";

};

保存退出
 
 vim /var/named/chroot/var/named/example.com.zone
$TTL    86400
@               IN SOA  example.com.      root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
 
example.com.       IN NS                www.example.com.
www              IN A           192.168.0.19
news              IN A          192.168.0.19
sport               IN A                192.168.0.19
保存退出
启动dns服务
 service named restart 
[root@localhost ~]# host news.example.com
news.example.com has address 192.168.0.19
root@localhost ~]# host www.example.com
www.example.com has address 192.168.0.19
[root@localhost ~]# host sport.example.com
sport.example.com has address 192.168.0.19

进入到mysql中 创建用户

grant all privileges on www.* to 'jingkong'@'192.168.0.19' identified by '123';
grant all privileges on news.* to 'xiaoze'@'192.168.0.19' identified by '123';
grant all privileges on sport.* to 'chunzi'@'192.168.0.19' identified by '123';

设置主机二

安装httpd  php php-mysql

vim /etc/httpd/conf/httpd.conf进行配置

NameVirtualHost *:80

    DocumentRoot /var/www/no1/upload

    ServerName www.example.com

    ErrorLog logs/19-error_log

    CustomLog logs/19-access_log common

    DocumentRoot /var/www/no2/upload

    ServerName news.example.com

    ErrorLog logs/223-error_log

    CustomLog logs/223-access_log common

    DocumentRoot /var/www/no3/upload

    ServerName sprot.example.com

    ErrorLog logs/222-error_log

    CustomLog logs/222-access_log common

保存退出然后将论坛文件的upload内的所有内容

copy到 上面

  DocumentRoot /var/www/no1
 DocumentRoot /var/www/no2
 DocumentRoot /var/www/no3

修改分别修改权限

chmod -R 757/var/www/no1

chmod -R 757 /var/www/no2

chmod -R 757 /var/www/no3

http://www.example.com/install/ 

 http://news.example.com/install/

http://sport.example.com/install/