把lamp環境搭建在一臺服務器中,(非分佈式)
1.使用yum安裝httpd mariadb php
[root@localhost ~]# yum -y install httpd mariadb-server mariadb php php-mysql
2.開啓服務
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl start mariadb
3.設置mysql數據庫的密碼
[root@localhost ~]# mysql_secure_installation
//更改mysql密碼
Enter current password for root (enter for none):
//輸入當前mysql數據庫root密碼,默認沒有,回車即可
Change the root password? [Y/n]
//設置重新設置root密碼
New password:
//新的密碼
Re-enter new password:
//確認密碼
Disallow root login remotely? [Y/n]
//是否允許root遠程登入
Remove test database and access to it? [Y/n]
//是否刪除測試數據庫並訪問它
Reload privilege tables now? [Y/n]
//是否重新加載特權表
Remove anonymous users? [Y/n]
//是否刪除匿名用戶
4.登錄Mariadb,併爲網站創建數據庫和管理用戶
[root@localhost ~]# mysql -uroot -p111
MariaDB [(none)]> create database bbs;
//創建數據庫bbs
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on bbs.* to runbbs@localhost identified by '123.com';
//添加bbs數據庫的管理賬號
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
5.測試php是否安裝成功
[root@localhost html]# firewall-cmd --add-port=80/tcp --permanent
//設置防火牆規則開放80端口
success
[root@localhost html]# firewall-cmd --reload
success
[root@localhost html]# firewall-cmd --list-ports
80/tcp
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim info.php
[root@localhost html]# cat info.php
<?php
phpinfo();
?>
測試訪問:http://192.168.1.61/info.php
6.搭建好lamp後,開始部署discuz論壇
首先下載discuz的源碼包
[root@localhost ~]# unzip Discuz_X3.3_SC_UTF8.zip
[root@localhost ~]# mv upload/ /var/www/html/bbs
//移動解壓後的upload到網站根目錄下
[root@localhost ~]# chmod -R 777 /var/www/html/bbs/
//設置bbs目錄權限
7.安裝discuz
訪問http://192.168.1.61/bbs
填寫剛創建的數據庫,和管理數據庫的用戶即可
8.訪問論壇後臺管理
http://192.168.1.61/bbs/admin.php
在後臺管理可以設置一些常用的配置。