(1)下载discuz!

[root@qiangge ~]# mkdir /data/www

[root@qiangge ~]# cd /data/www

[root@qiangge www]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip

[root@qiangge ~]#unzip Discuz_X3.2_SC_GBK.zip

[root@qiangge ~]#mv upload/* ./           //把upload里面的文件挪出来;

[root@qiangge ~]#rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip    

(2)配置第一个虚拟主机

[root@qiangge ~]#vim /usr/local/apache2/conf/httpd.conf          //进入配置文件

删除Include conf/extra/httpd-vhosts.conf前面的“#”,保存退出

然后编辑该配置文件

[root@qiangge ~]#vim /usr/local/apache2/conf/extra/httpd-vhosts.conf

在最后面加入如下配置:

<VirtualHost *:80>

  DocumentRoot "/data/www"

   ServerName www.test.com

   ServerAlias www.aaa.com

# ErrorLog "logs/dummy-host.example.com-error_log"                               // 错误日志

# CustomLog "logs/dummy-host.example.com-access_log" common         //访问日志

</VirtualHost>

先检查配置是否正确:

[root@qiangge www]# /usr/local/apache2/bin/apachectl -t

重启Apache服务,启动80端口

[root@qiangge www]# /usr/local/apache2/bin/apachectl restart

(3)配置MySQL,给discuz增加一个账户

给MySQL root 账户设置密码,然后命令行进入MySQL,创建新的库,并创建一个新的账号对该库有所有权限:

[root@qiangge www]# /usr/local/mysql/bin/mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.73-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

这样就可以进入到MySQL命令行内部,接着输入下面的命令,最前面的>不用输入。

mysql> create database discuz;

Query OK, 1 row affected (0.04 sec)

mysql> grant all on discuz.*to 'qiangzi'@'localhost' identified by '123456qiangzi';

Query OK, 0 rows affected (0.04 sec)

mysql> quit

Bye

就这样创建了一个库discuz,然后又建了一个用户“qiangzi”,密码是:12456qiangzi.

(4)安装discuz!

因为www.test.com这个域名是我们随便定义的,所以是不能直接访问的,需要先绑上host,其中host在Windows和Linux上都存在,可以吧一个域名指向到一个IP上。Windows下的文件路径是在:C:\Windows\System32\drivers\etc,用记事本打开,然后增加一行,保存:

192.168.1.184 www.test.com www.aaa.com

这里的IP地址192.168.1.184是虚拟机的IP。

在浏览器输入:

http//:www.test.com/install/

根据提示修改对应目录的权限

#cd /data/www

#chown -R daemon:daemon data uc_server/data uc_client/data config

让这几个目录支持Apache运行账号可写,daemon就是Apache的运行账号,在/usr/local/apache2/conf/http.conf中用User和Group定义的。

wKiom1lA_qiDaiyyAADQSlO3Fck250.png

wKiom1lA_qmwEEgnAACmRemAkT4371.png

wKioL1lA_qnAGa5RAAB3LrcbcMY160.png

wKiom1lA_qrjvBM7AAC54YpmAOw123.png

在这一步,数据库名,就是我们上面创建的新数据库。数据库用户名和密码就是我们在前面刚创建的用户名和密码。管理员密码一定要记得,一会还需要登录,点下一步后,就会看到安装数据库的过程,稍后就弹出“discuz应用中心”的页面,不过我们不需要安装任何应用,直接点击右下角“点此访问”,这样就安装成功了discuz论坛。

wKiom1lA_tTjaX_JAADji1Q5lkA410.png

wKioL1lA_tWh8VgiAAQPSA4FZ-o812.png

wKiom1lA_tbAdmuGAAC_ga6HTSc518.png

(5)卸载系统自带的MySQL

要想用之前安装的MySQL(/usr/local/mysql/bin/mysql)必须先卸载电脑上自带的MySQL

[root@qiangge www]# which mysql                 //查看系统MySQL的位置

/usr/bin/mysql

[root@qiangge www]# rpm -qf /usr/bin/mysql

mysql-5.1.73-8.el6_8.i686

为了方便进入MySQL,需要做一个path

[root@qiangge www]# vim /etc/profile.d/path.sh

进入文件之后添加

#! /bin/bash

export PATH=$PATH:/usr/local/mysql/bin

保存退出

[root@qiangge www]# source !$

source /etc/profile.d/path.sh

就OK了

然后直接输入MySQL,就可以运行了(退出MySQL用:quit)