实验名称:论坛软件系统Discuz!
实验概述:采用linux+apache+mysql+php搭建Discuz论坛
实验步骤:
1.首先,将实验所需要的软件包全都安装上:
[root@localhost ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/Server/
[root@localhost Server]#
[root@localhost Server]# rpm -ivh bind-9.3.3-7.el5.i386.rpm caching-nameserver-9.3.3-7.el5.i386.rpm
warning: bind-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:bind                   ########################################### [ 50%]
   2:caching-nameserver     ########################################### [100%]
[root@localhost Server]# rpm -ivh httpd-2.2.3-6.el5.i386.rpm
warning: httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:httpd                  ########################################### [100%]
[root@localhost Server]# rpm -ivh php-5.1.6-5.el5.i386.rpm php-cli-5.1.6-5.el5.i386.rpm php-common-5.1.6-5.el5.i386.rpm
warning: php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:php-common             ########################################### [ 33%]
   2:php-cli                ########################################### [ 67%]
   3:php                    ########################################### [100%]
[root@localhost Server]# rpm -ivh mysql-5.0.22-2.1.i386.rpm mysql-server-5.0.22-2.1.i386.rpm php-mysql-5.1.6-5.el5.i386.rpm php-pdo-5.1.6-5.el5.i386.rpm perl-DBD-MySQL-3.0007-1.fc6.i386.rpm perl-DBI-1.52-1.fc6.i386.rpm
warning: mysql-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:perl-DBI               ########################################### [ 17%]
   2:mysql                  ########################################### [ 33%]
   3:perl-DBD-MySQL         ########################################### [ 50%]
   4:php-pdo                ########################################### [ 67%]
   5:mysql-server           ########################################### [ 83%]
   6:php-mysql              ########################################### [100%]
[root@localhost ~]# service named start
Starting named:                                            [ OK ]
[root@localhost ~]# vim /etc/named.caching-nameserver.conf   将这四行注释了:
//      listen-on port 53 { 127.0.0.1; };
//      allow-query     { localhost; };
//      match-clients      { localhost; };
//      match-destinations { localhost; };
添加一个区域:
[root@localhost ~]# vim /etc/named.rfc1912.zones 
zone "wuli.com" IN {
        type master;
        file "wuli.com.zone";
};
[root@localhost ~]# vim /var/named/wuli.com.zone
@       IN      SOA     ns.wuli.com.    root.wuli.com. (
        20090318
        28800
        14400
        3600000
        86400)
@       IN      NS      ns.wuli.com.
ns      IN      A       172.16.4.5
www     IN      CNAME   ns.wuli.com.
bbs     IN      CNAME   ns.wuli.com.
编辑/etc/resolv.conf中添加如下:
[root@localhost ~]# vim /etc/resolv.conf
nameserver 172.16.4.5
重启服务:
[root@localhost ~]# service named restart
Stopping named:                                            [ OK ]
Starting named:                                            [ OK ]
测试一下:
[root@localhost ~]# nslookup
> www.wuli.com
Server:         172.16.4.5
Address:        172.16.4.5#53
 
www.wuli.com    canonical name = ns.wuli.com.
Name:   ns.wuli.com
Address: 172.16.4.5
> bbs.wuli.com
Server:         172.16.4.5
Address:        172.16.4.5#53
 
bbs.wuli.com    canonical name = ns.wuli.com.
Name:   ns.wuli.com
Address: 172.16.4.5
开启Apache服务:
[root@localhost ~]# service httpd start
Starting httpd:                                            [ OK ]
编辑如下修改其中的四项:
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
KeepAlive On
DefaultType application/octet-stream
AddDefaultCharset zh-CN
Options FollowSymLinks   去掉Indexes
重启服务:
[root@localhost ~]# service httpd restart
Stopping httpd:                                            [ OK ]
Starting httpd:                                            [ OK ]
编辑基于名称的虚拟主机的配置:
[root@localhost ~]# vim /etc/httpd/conf.d/wuli.conf
NameVirtualHost 172.16.4.5
<VirtualHost 172.16.4.5>
        ServerName www.wuli.com
        DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost 172.16.4.5>
        ServerName bbs.wuli.com
        DocumentRoot /var/www/html/bbs
</VirtualHost>
在/var/www/html/下创建一个bbs的目录:
[root@localhost ~]# mkdir /var/www/html/bbs
开启数据库的服务:
[root@localhost ~]# service mysqld start
给数据库管理员设置密码:
 [root@localhost ~]# mysqladmin -u root password 123456
让数据库用户登录:
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)
创建新的数据库:
mysql> create database bbsdb;
Query OK, 1 row affected (0.00 sec)
 
mysql> grant all on bbsdb.* to bbsuser@localhost identified by "123456"
Query OK, 0 rows affected (0.00 sec)
重启数据库服务:
[root@localhost ~]# service mysqld restart
Stopping MySQL:                                            [ OK ]
Starting MySQL:                                            [ OK ]
将Discuz!_6.0.0_SC_GBK.zip 导入到root家目录:
[root@localhost ~]# ls
anaconda-ks.cfg Discuz!_6.0.0_SC_GBK.zip install.log install.log.syslog
新建一个目录名为d6,将Discuz剪切到里面解压:
[root@localhost ~]# mkdir d6
[root@localhost ~]# mv Discuz\!_6.0.0_SC_GBK.zip d6/
[root@localhost ~]# ls
anaconda-ks.cfg  d6 install.log install.log.syslog
[root@localhost ~]# cd d6/
[root@localhost d6]# ls
Discuz!_6.0.0_SC_GBK.zip
[root@localhost d6]# unzip Discuz\!_6.0.0_SC_GBK.zip
[root@localhost d6]# ls
Discuz!_6.0.0_SC_GBK.zip upload usersguide users_guide.htm utilities
然后将upload里的所有内容拷贝到/var/www/html/bbs/
[root@localhost d6]# cp -r ./upload/* /var/www/html/bbs/
现在写一个首页,测试一下:
[root@localhost d6]# vim /var/www/html/index.php
<?php
        phpinfo();
?>
重启httpd 的服务:
[root@localhost d6]# service httpd restart
Stopping httpd:                                            [ OK ]
Starting httpd:                                            [ OK ]

使用客户端浏览器测试:

1

 

2

 

 

点击下一步后,进入此地改权限:
[root@localhost bbs]# pwd
/var/www/html/bbs

[root@localhostbbs]#chmod777 ./templates ./p_w_uploads ./customavatars ./forumdata ./forumdata/templates ./forumdata/cache ./forumdata/threadcaches./forumdata/logs

 

3

 

填写数据库的信息:
[root@localhost bbs]# vim ./config.inc.php
$dbhost = 'localhost';
$dbuser = 'bbsuser';
$dbpw = '123456'; 
$dbname = 'bbsdb'; 
$pconnect = 0; 
重启服务:
[root@localhost bbs]# service mysqld restart
Stopping MySQL:                                            [ OK ]
Starting MySQL:                                            [ OK ]

4

 

5

 

6

 

7

就此,实验已经全部安装完成,一个新的论坛搭建好了。