论坛搭建
#1.停止防火墙
[root@localhost ~]# systemctl stop firewalld
#2.关闭selinux
[root@localhost ~]# setenforce 0
#3.挂载光盘镜像,配置yum
#4.安装php
[root@localhost ~]# yum install -y php*
#5.安装httpd服务
[root@localhost ~]# yum install httpd -y
#6.安装数据库
[root@localhost ~]# yum install -y mariadb-server -y
#7.启动数据库
[root@localhost ~]# systemctl start mariadb
#8.查看状态
[root@localhost ~]# systemctl status mariadb
Active: active (running) since Wed 2022-07-20 21:34:43 >
#9.初始化数据库
[root@localhost ~]# mysql_secure_installation
"""
Enter current password for root (enter for none): #输入密码,默认没有数据库密码,回车就好了
Set root password? [Y/n] #设置数据库密码,输入Y
Remove anonymous users? [Y/n] #是不是删掉匿名用户,Y
Disallow root login remotely? [Y/n] #是不是远程登录,n
Remove test database and access to it? [Y/n] #是不是把两个数据库给移掉,n
Reload privilege tables now? [Y/n] #是否重新刷新权限,Y
"""
#10.创建数据库,登录数据库
[root@localhost ~]# mysql -uroot -p
Enter password:
#11.查看有哪些数据库
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
#12.搭建论坛数据库
MariaDB [(none)]> create database luntan;
Query OK, 1 row affected (0.000 sec)
#13.查看一下
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| luntan |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.000 sec)
#14.退出数据库
MariaDB [(none)]> exit
Bye
#15.重启两个服务
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# systemctl restart httpd
#16.复制并解压论坛源码,论坛的包在下面,上传上去之后
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ll
total 11684
-rw-r--r--. 1 root root 11962143 Jul 20 22:33 Discuz_X3.4_SC_UTF8_20220518.zip
[root@localhost html]# unzip Discuz_X3.4_SC_UTF8_20220518.zip
[root@localhost html]# ll
total 11804
-rw-r--r--. 1 root root 11962143 Jul 20 22:33 Discuz_X3.4_SC_UTF8_20220518.zip
-rw-r--r--. 1 root root 8310 May 18 15:15 LICENSE
-rw-r--r--. 1 root root 26774 Sep 22 2021 qqqun.png
drwxr-xr-x. 2 root root 124 May 20 13:20 readme
-rw-r--r--. 1 root root 71393 Jan 31 14:53 readme.html
drwxr-xr-x. 13 root root 4096 May 20 13:20 upload
-rw-r--r--. 1 root root 142 Jan 29 17:51 utility.htm
#17.修改权限
[root@localhost html]# cd /var/www/html/upload/
[root@localhost upload]# ll
total 68
-rw-r--r--. 1 root root 2848 May 20 13:20 admin.php
drwxr-xr-x. 9 root root 135 May 20 13:20 api
-rw-r--r--. 1 root root 727 May 20 13:20 api.php
drwxr-xr-x. 2 root root 23 May 20 13:20 archiver
drwxrwxrwx. 2 root root 90 May 20 13:20 config
-rw-r--r--. 1 root root 1040 May 20 13:20 connect.php
-rw-r--r--. 1 root root 106 May 20 13:20 crossdomain.xml
drwxrwxrwx. 12 root root 178 May 20 13:20 data
-rw-r--r--. 1 root root 5558 May 18 15:15 favicon.ico
-rw-r--r--. 1 root root 2245 May 20 13:20 forum.php
-rw-r--r--. 1 root root 821 May 20 13:20 group.php
-rw-r--r--. 1 root root 1280 May 20 13:20 home.php
-rw-r--r--. 1 root root 6655 May 20 13:20 index.php
drwxr-xr-x. 5 root root 64 May 20 13:20 install
drwxr-xr-x. 2 root root 23 May 20 13:20 m
-rw-r--r--. 1 root root 998 May 20 13:20 member.php
-rw-r--r--. 1 root root 2371 May 20 13:20 misc.php
-rw-r--r--. 1 root root 1788 May 20 13:20 plugin.php
-rw-r--r--. 1 root root 977 May 20 13:20 portal.php
-rw-r--r--. 1 root root 615 May 20 13:20 robots.txt
-rw-r--r--. 1 root root 1274 May 20 13:20 search.php
drwxr-xr-x. 10 root root 168 May 20 13:20 source
drwxr-xr-x. 7 root root 86 May 20 13:20 static
drwxr-xr-x. 3 root root 38 May 20 13:20 template
drwxrwxrwx. 7 root root 106 May 20 13:20 uc_client
drwxrwxrwx. 13 root root 241 May 20 13:20 uc_server
[root@localhost upload]# chmod 777 config/ data/ uc_* -R
[root@localhost upload]# systemctl restart httpd
[root@localhost upload]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1045/sshd
tcp6 0 0 :::22 :::* LISTEN 1045/sshd
tcp6 0 0 :::3306 :::* LISTEN 3666/mysqld
tcp6 0 0 :::80 :::* LISTEN 4401/httpd
#18.通过页面访问并安装
1)用IP登录浏览器,进入apache测试页
2)进入论坛,要访问/upload里面,点击愿意,在里面安装就好了
3)如果进去之后,显示文件不存在,不可写
#先查看防火墙是否关闭 [root@localhost upload]# getenforce Permissive #在/etc/selinux/config中修改 [root@localhost upload]# vim /etc/selinux/config """ SELINUX=enforcing #将这行改成SELINUX=permissive """
4)点击下一步,选择全新安装(其实选择哪个都可以)
5)修改安装数据库,设置完,点击下一步
数据库名跟数据库密码是之前创建的,数据标前缀,是在运行数据库时,用到的(建议不改),邮箱该不该都可以。
管理员密码自己设置,记得住就行,邮箱也是该不该都可以。
6)安装完成之后,上面的都是广告,点击“您的论坛已完成安装,点击回访”
7)就创建成功了
8)在左上角登录用户名跟密码,通过写验证码,就进入自己论坛了