事前准备
1、Discuz_X3.5_SC_UTF8_20230520的压缩包。
2、一台虚拟机,xshell和xftp(用来传输文件)
安装httpd 软件并将压缩包移动到指定目录
mount /dev/sr0 /mnt #### 挂载光盘到 /mnt 目录
dnf install httpd -y ### 安装httpd 软件
ll /var/www/html/ ### 查看指定目录
mv Discuz_X3.5_SC_UTF8_20230520.zip /var/www/html/ ### 移动源码包到目标目录
cd /var/www/html/ ### 切换目录
解压源码包
unzip Discuz_X3.5_SC_UTF8_20230520.zip
切换到upload目录,修改目录中指定文件的权限
cd upload/ #### 切换到目录
ll
chmod 777 data/ config/ uc_client/ uc_server/ -R #### 修改指定目录的权限 -R 表示递归修改
启动httpd服务,关闭防火墙服务(也可以设定相关的防火墙规则)
systemctl start httpd #### 启动httpd 服务
systemctl stop firewalld ### 停止防火墙服务小知识点:
netstat -lntup ### 查看服务端口
systemctl status httpd ### 查看服务状态
systemctl is-active httpd ### 查看服务状态
下载PHP相关组件,重启httpd服务
dnf install php* ### 安装php相关组件
systemctl restart httpd #### 安装php之后一定要重启httpd服务注意事项:
如果知道要下载什么组件也可以精准安装,*是通配符代表全部安装 PHP 之后一定要重启httpd服务,主要有以下原因:
加载新模块:安装 PHP 相关组件后,会有新的 PHP 模块被添加到系统中,例如php-fpm(FastCGI 进程管理器)等。httpd服务需要重新启动才能加载这些新的模块,以便能够识别和处理 PHP 脚本。如果不重启,httpd服务将无法感知到新安装的 PHP 模块,导致无法正确解析和执行 PHP 代码。
更新配置文件:安装 PHP 过程中,可能会对与httpd服务相关的配置文件进行修改,比如httpd.conf文件中关于文件类型映射、模块加载顺序等配置。这些修改不会立即生效,只有重启httpd服务,才能使新的配置文件生效,让httpd服务按照新的配置来运行,确保与 PHP 的集成能够正常工作。
初始化环境变量:PHP 安装可能会添加一些新的环境变量,或者修改现有的环境变量。httpd服务在启动时会读取当前的环境变量。重启httpd服务可以让它获取到最新的环境变量信息,以便在处理 PHP 请求时能够正确使用这些变量,例如找到 PHP 的安装路径、扩展库路径等
停止selinux(也可以打标签,跟防火墙一样跟安全相关),下载安装 mariadb 数据库 (mysql几乎是一样 )
setenforce 0 #### 停止SELinux安全工具 目前只是临时停止,重启系统之后,需要再次停止dnf install mariadb-server -y #### 安装 mariadb 数据库 和mysql几乎是一样
systemctl start mariadb ### 启动数据库服务
systemctl status mariadb ### 查看服务状态
netstat -lntup ## 查看数据库服务监听的端口
打开浏览器http://192.168.153.132/upload/
这个ip是你自己的地址,如果进不去,可以先输入192.168.153.132,进到红帽的网站,再去加,红帽的网站进不去就是httpd没有成功执行
一直下一步到创建数据库。
进入数据库进行相关操作
[root@localhost upload]# mysql -uroot -p ##使用mysql 客户端 -u 指定用户 root -p 指定密码 默认没有密码
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.16-MariaDB MariaDB ServerCopyright (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)]> show databases; #### 查看当前拥有的数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)MariaDB [(none)]> create database luntan; #### 创建数据库
Query OK, 1 row affected (0.001 sec)MariaDB [(none)]> show databases; #### 查看数据库
+--------------------+
| Database |
+--------------------+
| information_schema |
| luntan |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.001 sec)MariaDB [(none)]>
MariaDB [(none)]>
MariaDB [(none)]>
MariaDB [(none)]> use mysql; ### 使用或者指定某个数据库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
MariaDB [mysql]> alter user 'root'@'localhost' identified by 'redhat'; ## 修改 root 账号的密码为 redhat
Query OK, 0 rows affected (0.001 sec)MariaDB [mysql]> exit #### 退出数据库
Bye
[root@localhost upload]#
[root@localhost upload]#
[root@localhost upload]# mysql -uroot -p #### 再次登录,输入用户密码
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.5.16-MariaDB MariaDB ServerCopyright (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)]> exit
Bye
安装数据库
点击第一个或者第三个,你就成功进入论坛了。
发帖方法
1、点击主页(小房子)
2、点击快捷导航默认版块
3、点击发新帖就行
4、成功