1. 程式人生 > 其它 >快速部署LAMP黃金架構,搭建disuz論壇

快速部署LAMP黃金架構,搭建disuz論壇

快速部署LAMP架構

[root@zhanghuan ~]# iptables -F
[root@zhanghuan ~]# systemctl stop firewalld
[root@zhanghuan ~]# systemctl disable firewalld
[root@zhanghuan ~]# getenforce
Disabled

# 停止,以及把nginx應用程式解除安裝了
[root@zhanghuan yum.repos.d]# yum remove nginx -y

# 安裝apache 這個web伺服器,應用程式
[root@zhanghuan yum.repos.d]# yum install httpd
Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package httpd-2.4.6-97.el7.centos.x86_64 already installed and latest version
Nothing to do


# 啟動apache
systemctl start httpd

[root@zhanghuan yum.repos.d]# netstat -tunlp|grep httpd
tcp6       0      0 :::80                   :::*                   LISTEN      3633/httpd
tcp6       0      0 :::443                 :::*                   LISTEN      3633/httpd


部署mysql


# yum 安裝即可
# 安裝
yum install mariadb-server mariadb -y
# 啟動
[root@zhanghuan yum.repos.d]# systemctl start mariadb
# 驗證mysql,預設的服務視窗,埠port,3306
[root@zhanghuan yum.repos.d]# netstat -tunlp | grep "mysql"
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      3965/mysqld

# 使用,訪問
# 瞭解基本的sql語句
[root@zhanghuan yum.repos.d]# mysql   -uroot   -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-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)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql             |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> use mysql;

# 查詢user表的資訊(轉化思想去理解。這個mysql資料夾下,有一個名為user的excel表格)
# mysql專業的查詢語句

MariaDB [mysql]> select user,password,host from user;
+------+----------+-----------+
| user | password | host     |
+------+----------+-----------+
| root |         | localhost |
| root |         | ceph     |
| root |         | 127.0.0.1 |
| root |         | ::1       |
|     |         | localhost |
|     |         | ceph     |
+------+----------+-----------+
6 rows in set (0.00 sec)

MariaDB [mysql]> exit
Bye

部署php結合apache


1.解決php安裝的依賴開發環境
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel pcre pcre-devel apr apr-devel zlib-devel gcc make

2.安裝php,以及php連線mysql資料庫的驅動
[root@zhanghuan ~]# yum install php php-fpm php-mysql -y


3.php不需要額外修改,但是需要修改apache配置檔案,支援php的指令碼讀取即可

# php程式和apache結合工作

4.編輯apache配置檔案
vim /etc/httpd/conf/httpd.conf

5.進行配置檔案修改
# 使用vim,顯示行號 :set nu
# 在120行左右這裡,新增如下配置

119 DocumentRoot "/var/www/html"
120     TypesConfig /etc/mime.types
121     AddType application/x-httpd-php .php
122     AddType application/x-httpd-php-source .phps
123     DirectoryIndex index.php index.html


6.編寫一個php的指令碼,看apache是否能正確載入讀取
# 這個指令碼需要放置在如下位置
vim /var/www/html/index.php
<meta charset=utf8>
我是新的首頁,你好兄弟們
<?php
phpinfo();
?>

7.重啟apache
[root@zhanghuan ~]# systemctl restart httpd
[root@zhanghuan ~]#


  • 看到phpinfo的頁面後,就表示你的linux + apache + mysql + php這個黃金架構環境,搭建好了

  • 你就可以在此環境上,來執行其他的程式碼了。

  • 你公司的php程式碼

  • 教大家部署一個論壇。

 

 

 

部署一個論壇disuz


# 下載論壇的壓縮程式碼
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

# 2.解壓縮程式碼包,使用解壓命令 unzip
yum install unzip -y

# 3.解壓縮

# 4.拷貝upload程式碼到apache目錄下,即可訪問
[root@zhanghuan discuz]# cp -r upload/* /var/www/html/
cp: overwrite ‘/var/www/html/index.php’? y

# 5.修改程式碼許可權
[root@zhanghuan discuz]# chmod -R 777 /var/www/html/*