基于 LAMP 环境部署 Discuz 论坛
LAMP环境部署
一、基于VMware虚拟机部署Centos系统
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
二、基于Centos7.6安装Httpd服务
1、关闭防火墙、selinux 服务
systemctl stop firewalld
setenforce 0
2、安装部署httpd服务
- 下载并启动httpd服务、且设置为开机自启
[root@localhost ~]# yum install -y httpd
[root@localhost ~]# systemctl start httpd && systemctl enable httpd
此处采用yum源安装,或可采用下方源码安装方法
运维之道 | Centos7源码安装配置Apache
3、安装部署mariadb服务
- 卸载系统原有的数据库、并清理原有配置文件(否则会报mysql.sock无法连接)
[root@localhost ~]# yum remove -y mariadb
[root@localhost ~]# rm -rf /etc/my.cnf
[root@localhost ~]# rm -rf /var/lib/mysql
- 安装并启动mariadb服务、并设置为开机自启
[root@localhost ~]# yum install -y mariadb mariadb-server mariadb-devel
[root@localhost ~]# systemctl start mariadb && systemct enable mariadb
- 进入数据库创建discuz库、并创建discuz用户及授权
[root@localhost ~]# mysql -uroot -p
MariaDB [(none)]> create database discuz;
MariaDB [(none)]> grant all on discuz.* to 'discuz'@'localhost' identified by "123456";
MariaDB [(none)]> flush privileges;
4、web1-2主机中安装php服务
[root@localhost ~]# yum install -y php php-devel php-mysql
Discuz环境部署
三、安装部署Discuz论坛
web1、web2均要部署
1、获取Discuz源码包
[root@localhost ~]# wget http://download.comsenz.com/DiscuzX/3.1/Discuz_X3.1_SC_UTF8.zip
2、将Discuz包解压到httpd的发布目录下
[root@localhost ~]# unzip Discuz_X3.1_SC_UTF8.zip -d /var/www/html/
3、进入到/var/www/html/目录下,将upload目录下所有内容移至html目录中,并授权
[root@localhost html]# mv upload/* .
[root@localhost html]# chmod 777 -R *
4、进入Discuz安装界面进行配置(一定要关闭防火墙和selinux,否则会报错)
访问:192.168.182.12/install/