discuz安装配置(基于centos7)
查看系统版本
[root@D ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
一 安装前准备(保证lamp都没有安装):
1,关闭防火墙和selinux
2,保证yum源可以使用
3,没有安装httpd,php,mariadb
4,如果虚拟机无法上网提前准备好discuz的安装包
二 安装mysql(7默认用的是mariaDB):保证自己yum源能用
[root@D ~]# yum install mariadb-server mariadb -y
三 初始化数据库
[root@D ~]# systemctl start mariadb //开启服务
[root@D ~]# systemctl enable mariadb //开机自启
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
# 下面这条命令可以初始化mysql,删除匿名用户,设置root密码等等....
[root@D ~]# mysql_secure_installation
[root@D ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
四 创建数据库(给软件创个数据库)
[root@D ~]# mysql -uroot -p //登录数据库
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create databsae discuz; //创建数据库
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| discuz |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@D ~]#
五 下载Apache
使用 yum 安装 Apache 组件:
[root@D ~]# yum install httpd -y
安装之后,启动 httpd 进程:
[root@D ~]# systemctl start httpd
把 httpd 也设置成开机自动启动:
[root@D ~]# systemctl enable httpd
测试:在真机上输入虚拟机ip
六 安装PHP
使用 yum 安装 PHP和:
[root@D ~]# yum install php php-fpm php-mysql -y
安装之后,启动 PHP-FPM 进程:
[root@D ~]# systemctl start php-fpm
把 PHP-FPM 也设置成开机自动启动:
[root@D ~]# systemctl enable php-fpm
七 安装 Discuz
CentOS 7 没有Discuz 的 yum 源,所以我们需要下载一个Discuz 压缩包:
或者提前下好上传服务器,
[root@D ~]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
下载完成后,解压这个压缩包
[root@D ~]# unzip Discuz_X3.2_SC_UTF8.zip
[root@D ~]# ls
Discuz_X3.2_SC_UTF8.zip readme upload utility
[root@D ~]#
解压完后,就能在 发现多了三个文件夹 readme upload utility
upload 里是discuz的源码
八 配置 Discuz
//把软件的源码考到网站目录下
[root@D ~]# cp -r upload/* /var/www/html/
//给 /var/www/html 目录及其子目录赋予权限
[root@D ~]# chmod -R 777 /var/www/html
//重启 Apache
[root@D ~]# systemctl restart httpd
九 在真实机上输入虚拟机ip地址
7.登录管理员账户