溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Centos -7 .4LAMP架構(gòu)Discuz論壇

發(fā)布時(shí)間:2020-06-28 03:38:06 來(lái)源:網(wǎng)絡(luò) 閱讀:1064 作者:23trl 欄目:云計(jì)算

Centos -7 .4LAMP架構(gòu)Discuz論壇

Linux -Centos -7 LAMP架構(gòu)論壇網(wǎng)頁(yè)詳解

LAMP架構(gòu)原理
客戶的一個(gè)用戶請(qǐng)求,通過(guò)http協(xié)議,tcp端口,三次握手,發(fā)送給web端,如果是靜態(tài)資源本地就可以解決回饋給用戶,如果是動(dòng)態(tài)資源就通過(guò)fastcgi去調(diào)動(dòng)php,php通過(guò)驅(qū)動(dòng)去調(diào)取mysql,靜態(tài)資源圖片,視頻,動(dòng)態(tài)資源交互性的信息,比如用戶登錄。

實(shí)驗(yàn)?zāi)康模航AMP架構(gòu)上再放一個(gè)論壇的網(wǎng)頁(yè)

一.LAMP架構(gòu)概述

Centos -7 .4LAMP架構(gòu)Discuz論壇

需要三種組件:linux,Apache,Mysql,它們的源碼包私信我,我發(fā)給你,不需要再到官方文檔上再下。

一.了解Apache起源

Centos -7 .4LAMP架構(gòu)Discuz論壇

二.編譯安裝httpd服務(wù)器的優(yōu)點(diǎn)

Centos -7 .4LAMP架構(gòu)Discuz論壇

三.httpd.conf配置文件參數(shù)

Centos -7 .4LAMP架構(gòu)Discuz論壇

Listen:監(jiān)聽的IP地址,端口號(hào)
ServerName:網(wǎng)站服務(wù)器的域名
這兩個(gè)我們后面需要修改

四.httpd.conf配置文件參數(shù)(續(xù))

Centos -7 .4LAMP架構(gòu)Discuz論壇

五.我們先在宿主機(jī)把我們需要的源碼包共享出來(lái)

(如果你共享的文件linux訪問(wèn)不了共享文件,檢查你的本地策略,拒絕從網(wǎng)絡(luò)訪問(wèn)此計(jì)算機(jī)把你的用戶刪掉,檢查你的網(wǎng)絡(luò)發(fā)現(xiàn),不會(huì)的,請(qǐng)看我之前的博客)
Centos -7 .4LAMP架構(gòu)Discuz論壇
Centos -7 .4LAMP架構(gòu)Discuz論壇
Centos -7 .4LAMP架構(gòu)Discuz論壇

六.宿主機(jī)的vmnet1網(wǎng)卡設(shè)置IP地址

Centos -7 .4LAMP架構(gòu)Discuz論壇

七.liunx Centos7去訪問(wèn),掛載共享文件。

[root@localhost ~]# smbclient -L //192.168.100.3/  //訪問(wèn)宿主機(jī)的IP地址
Enter SAMBA\root's password: 
OS=[Windows 10 Enterprise 17763] Server=[Windows 10 Enterprise 6.3]

    Sharename       Type      Comment
    ---------       ----      -------
    ADMIN$          Disk      遠(yuǎn)程管理
    C$              Disk      默認(rèn)共享
    D$              Disk      默認(rèn)共享
    E$              Disk      默認(rèn)共享
    F$              Disk      默認(rèn)共享
    G$              Disk      默認(rèn)共享
    IPC$            IPC       遠(yuǎn)程 IPC
    LAMP            Disk      
    LAMP-C7         Disk      
    share           Disk      
    Users           Disk      
Connection to 192.168.100.3 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available
[root@localhost ~]# mount.cifs //192.168.100.3/LAMP-C7 /mnt/  //掛載到mnt目錄
Password for root@//192.168.100.3/LAMP-C7:  
[root@localhost ~]# cd /mnt
[root@localhost mnt]# ls             看掛載目錄下有沒有這些源碼包
[root@localhost mnt]# cd /mnt
[root@localhost mnt]# ls
apr-1.6.2.tar.gz       Discuz_X2.5_SC_UTF8.zip  LAMP-php5.6.txt      php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz  httpd-2.4.29.tar.bz2     mysql-5.6.26.tar.gz

八.把底層的跨平臺(tái)工具包解壓縮到opt目錄底下

tar zxvf apr-1.6.2.tar.gz -C /opt
tar zxvf apr-util-1.6.0.tar.gz -C /opt

九.把HTTP工具包解壓縮到opt目錄底下,再把跨平臺(tái)工具包解壓好的兩個(gè)文件放到HTTP工具包底下

tar jxvf httpd-2.4.29.tar.bz2 -C /opt
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
[root@localhost mnt]# cd /opt
[root@localhost opt]# ls
apr-1.6.2  apr-util-1.6.0  httpd-2.4.29  rh
[root@localhost opt]# mv apr-1.6.2 httpd-2.4.29/srclib/apr
[root@localhost opt]# mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util
[root@localhost opt]# ls
httpd-2.4.29  rh

10.安裝環(huán)境包

[root@localhost opt]# yum -y install \
gcc \
gcc-c++ \   //環(huán)境語(yǔ)言
make \      //編譯成能讓計(jì)算機(jī)識(shí)別的語(yǔ)言
pcre-devel \  //pcre語(yǔ)言,就像正則表達(dá)式一樣
expat-devel \  //支持識(shí)別標(biāo)簽性語(yǔ)言
perl    //perl編譯器

11.手工編譯安裝

[root@localhost opt]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ./configure \
> --prefix=/usr/local/httpd \    //"\"代表?yè)Q行表示,指定路徑
> --enable-so \      //apache核心模塊開啟
> --enable-rewrite \    //開啟重寫功能,防盜鏈
> --enable-charset-lite \  //支持字符集,簡(jiǎn)體中文
> --enable-cgi   //通用網(wǎng)關(guān)接口
> 
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options:
Server Version: 2.4.29
Install prefix: /usr/local/httpd
C compiler:     gcc -std=gnu99
CFLAGS:          -g -O2 -pthread  
CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
LDFLAGS:           
LIBS:             
C preprocessor: gcc -E

12.把我們的配置文件轉(zhuǎn)換成機(jī)器能識(shí)別的語(yǔ)言,然后再安裝

[root@localhost httpd-2.4.29]# make 

les -module -avoid-version  mod_rewrite.lo 
make[4]: 離開目錄“/opt/httpd-2.4.29/modules/mappers”
make[3]: 離開目錄“/opt/httpd-2.4.29/modules/mappers”
make[2]: 離開目錄“/opt/httpd-2.4.29/modules”
make[2]: 進(jìn)入目錄“/opt/httpd-2.4.29/support”
make[2]: 離開目錄“/opt/httpd-2.4.29/support”

make[1]: 離開目錄“/opt/httpd-2.4.29”
[root@localhost httpd-2.4.29]# make install
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: 離開目錄“/opt/httpd-2.4.29”

13.把a(bǔ)pache啟動(dòng)腳本放進(jìn)去

[root@localhost httpd-2.4.29]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd    //把啟動(dòng)腳本放進(jìn)去方便管理,重新命名httpd

14.到vi /etc/init.d/httpd去配置文件參數(shù)

配置文件首行加入?yún)?shù)
#/bin/sh
#hkconfig: 35 85 21 //35級(jí)別自動(dòng)運(yùn)行  第85個(gè)啟動(dòng) 第21個(gè)關(guān)閉
#escription: Apache is a World Wide Web server

15.將httpd加入到SERVICE管理器

[root@localhost init.d]# chkconfig --add httpd
[root@localhost init.d]# 

16.vi /usr/local/httpd/conf/httpd.conf //到配置文件中配置參數(shù)

#ServerName www.yun.com:80

#Listen 192.168.136.132:80
Listen 80

17.做軟鏈接

ln -s /usr/local/httpd/conf/httpd.conf /etc/   //做個(gè)軟鏈接,下次直接就輸入vim /etc/httpd.conf就行
ln -s /usr/local/httpd/bin/* /usr/local/bin/   //做個(gè)軟鏈接,便于你的系統(tǒng)可以識(shí)別

18.檢查配置文件語(yǔ)法錯(cuò)誤

[root@localhost init.d]# httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[root@localhost init.d]# apachectl -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK

19.開啟服務(wù)

[root@localhost init.d]# systemctl stop firewalld.service  //關(guān)閉防火墻
[root@localhost init.d]# setenforce 0  //關(guān)閉增強(qiáng)功能
[root@localhost init.d]# service httpd start  //開啟http服務(wù)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
httpd (pid 70331) already running
[root@localhost init.d]# netstat -anpt | grep 80  //查看監(jiān)聽端口
tcp        0      0 192.168.136.132:22      192.168.136.1:58031     ESTABLISHED 3506/sshd: root@pts 
tcp6       0      0 :::80                   :::*                    LISTEN      70331/httpd         
[root@localhost init.d]# 

20.去測(cè)試能不能訪問(wèn)HTTP服務(wù)

Centos -7 .4LAMP架構(gòu)Discuz論壇

二.編碼安裝MYSQL數(shù)據(jù)庫(kù)

[root@localhost init.d]# yum install ncurses-devel autoconf cmake -y  //安裝環(huán)境包和Cmake工具包
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
正在解決依賴關(guān)系
--> 正在檢查事務(wù)
---> 軟件包 autoconf.noarch.0.2.69-11.el7

三.把數(shù)據(jù)庫(kù)的軟件包解壓縮到opt底下,編譯環(huán)境包

[root@localhost mnt]# cd /mnt

tar xzvf mysql-5.6.26.tar.gz -C /opt
[root@localhost mnt]# cd /opt
[root@localhost opt]# ls
httpd-2.4.29  mysql-5.6.26  rh
[root@localhost opt]# cd /opt/mysql-5.6.26/
[root@localhost mysql-5.6.26]# 
cmake  \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \  //指定安裝路徑
-DDEFAULT_CHARSET=utf8 \  //指定字符集
-DDEFAULT_COLLATION=utf8_general_ci \  //指定字符集默認(rèn)
-DEXTRA_CHARSETS=all \  //指定擴(kuò)展字符集
-DSYSCONFIDIR=/etc \  //指定配置文件目錄
-DMYSQL_DATADIR=/home/mysql/ \  //指定數(shù)據(jù)庫(kù)里的數(shù)據(jù)文件
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock  //定義sock文件連接數(shù)據(jù)庫(kù)文件

四.編譯安裝,能讓計(jì)算機(jī)識(shí)別

如果出錯(cuò)誤一定要查看你的路徑對(duì)不對(duì)
[root@localhost mysql-5.6.26]# make
[root@localhost mysql-5.6.26]# make install
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o
Linking CXX executable mysql_embedded
[100%] Built target mysql_embedded
Scanning dependencies of target mysqltest_embedded
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
Linking CXX executable mysqltest_embedded
[100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[100%] Built target my_safe_process

五.配置數(shù)據(jù)庫(kù)

[root@localhost mysql-5.6.26]# cp support-files/my-default.cnf /etc/my.cnf  //把配置文件放進(jìn)去
cp:是否覆蓋"/etc/my.cnf"? yes
[root@localhost mysql-5.6.26]# 
[root@localhost mysql-5.6.26]# cp support-files/mysql.server /etc/init.d/mysqld   //把配置文件放到啟動(dòng)腳本
cp:是否覆蓋"/etc/init.d/mysqld"? yes
[root@localhost mysql-5.6.26]# chmod 755 /etc/init.d/mysqld  //添加執(zhí)行權(quán)限
[root@localhost mysql-5.6.26]# chkconfig --add /etc/init.d/mysqld //把服務(wù)添加到服務(wù)管理器中
[root@localhost mysql-5.6.26]# chkconfig  mysqld --level 35 on   //35級(jí)別開啟
[root@localhostmysql5.6.26]#echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
//啟動(dòng)系統(tǒng)環(huán)境變量
[root@localhost mysql-5.6.26]# source /etc/profile //啟動(dòng)系統(tǒng)環(huán)境變量
[root@localhost mysql-5.6.26]# echo $PATH  //查看系統(tǒng)環(huán)境變量,命令有沒有被添加進(jìn)去
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/local/mysql/bin
[root@localhost mysql-5.6.26]# useradd -s /sbin/nologin mysql  //創(chuàng)建程序用戶,不讓它登錄本地控制臺(tái)
[root@localhost mysql-5.6.26]# chown -R mysql:mysql   //提升路徑下所有用戶的權(quán)限 /usr/local/mysql/

六.初始化數(shù)據(jù)庫(kù)

[root@localhost mysql-5.6.26]# /usr/local/mysql/scripts/mysql_install_db \  //初始化數(shù)據(jù)庫(kù)
--user=mysql \   //數(shù)據(jù)庫(kù)用戶
--ldata=/var/lib/mysql \   //數(shù)據(jù)
--basedir=/usr/local/mysql \  //數(shù)據(jù)庫(kù)目錄
--datadir=/home/mysql  //數(shù)據(jù)庫(kù)存放目錄

七.開啟數(shù)據(jù)庫(kù),查看端口

[root@localhost mysql]# vim /etc/init.d/mysqld 

46 basedir=/usr/local/mysql   //指明路徑   46行
 47 datadir=/home/mysql    //指明數(shù)據(jù)庫(kù)存放位置   47行

[root@localhost mysql]# vim /etc/init.d/mysqld 
[root@localhost mysql]# service mysqld start   //開啟數(shù)據(jù)庫(kù)
Starting MySQL.... SUCCESS! 
[root@localhost mysql]# netstat -anpt | grep 3306  //查看監(jiān)聽端口
tcp6       0      0 :::3306                 :::*                    LISTEN      6458/mysqld         

八.給數(shù)據(jù)庫(kù)管理員設(shè)置密碼

[root@localhost mysql]# mysqladmin -u root -p password "abc123"
Enter password:
Warning: Using a password on the command line interface can be insecure.

九.安裝PHP環(huán)境

root@localhost opt]# yum -y install \
gd \     //圖像化處理,
libpng \    //支持PNG圖片
libpng-devel \
pcre \
pcre-devel \
libxml2-devel \   //支持解析,標(biāo)簽性語(yǔ)言
libjpeg-devel      //支持jpg圖片格式

十.解壓縮并且關(guān)聯(lián)數(shù)據(jù)庫(kù)和APACHE

[root@localhost mnt]# tar xjvf php-5.6.11.tar.bz2 -C /opt
cd /opt/php-5.6.11/

[root@localhost php-5.6.11]# ./configure \
> --prefix=/usr/local/php5 \ //指定安裝路徑
> --with-gd \  //gd庫(kù),圖像化處理
> --with-zlib \   //函數(shù)庫(kù)
> --with-apxs2=/usr/local/httpd/bin/apxs \  //給apache提供功能性模塊
> --with-mysql=/usr/local/mysql \  //關(guān)聯(lián)數(shù)據(jù)庫(kù)
> --with-config-file-path=/usr/local/php5 \  //關(guān)聯(lián)PHP配置
> --enable-mbstring   //功能性模塊加載

11.編譯,安裝,做軟鏈接

[root@localhost php-5.6.11]#make
[root@localhost php-5.6.11]#make install
Installing PEAR environment:      /usr/local/php5/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.12
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.3
[PEAR] PEAR           - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php5/etc/pear.conf
You may want to add: /usr/local/php5/lib/php to your php.ini include_path
/opt/php-5.6.11/build/shtool install -c ext/phar/phar.phar /usr/local/php5/bin
ln -s -f phar.phar /usr/local/php5/bin/phar
Installing PDO headers:          /usr/local/php5/include/php/ext/pdo/

[root@localhost php-5.6.11]# cp php.ini-development /usr/local/php5/php.ini
//復(fù)制配置文件到php.ini中
[root@localhost php-5.6.11]# ln -s /usr/local/php5/bin/* /usr/local/bin/  把php5的所有命令做個(gè)軟鏈接
[root@localhost php-5.6.11]# ln -s /usr/local/php5/sbin/* /usr/local/sbin/

[root@localhost php-5.6.11]# vim /etc/httpd.conf 
<IfModule dir_module>
    DirectoryIndex index.html index.php   
</IfModule>//默認(rèn)首頁(yè)加上php

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps//加入PHP的配置文件

12.進(jìn)入網(wǎng)頁(yè)配置文件,PHP

[root@localhost php-5.6.11]# cd /usr/local/httpd/htdocs/
root@localhost htdocs]# mv index.html index.php

vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>
[root@localhost htdocs]# ls
index.php

13.我們的LAMP架構(gòu)就好了

Centos -7 .4LAMP架構(gòu)Discuz論壇

14.配置數(shù)據(jù)庫(kù)

[root@localhost ~]# cd /mnt  //我們的論壇包在我們之前的源碼包中,要的私信我
[root@localhost mnt]# ls
apr-1.6.2.tar.gz         httpd-2.4.29.tar.bz2  php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz    LAMP-php5.6.txt
Discuz_X2.5_SC_UTF8.zip  mysql-5.6.26.tar.gz

[root@localhost mnt]# mysql -u root -p  //進(jìn)入數(shù)據(jù)庫(kù)
Enter password:     //輸入你的設(shè)置的密碼abc123
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.26 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database bbs;   //創(chuàng)建數(shù)據(jù)庫(kù)
Query OK, 1 row affected (0.00 sec)

mysql> show databases; //查看數(shù)據(jù)庫(kù)
+--------------------+
| Database           |
+--------------------+
| information_schema |
| bbs                |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.02 sec)

mysql> GRANT all ON bbs.* TO 'bbsuser'@'192.168.102.166' IDENTIFIED BY 'admin123';  //提升權(quán)限給BBS數(shù)據(jù)庫(kù)當(dāng)中所有的表格,給bbsuser用戶,給所有終端可以登錄,設(shè)置密碼admin123
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit  //退出
Bye

15.把論壇包解壓到opt底下

[root@localhost htdocs]# cd /mnt
[root@localhost mnt]# ls
apr-1.6.2.tar.gz         httpd-2.4.29.tar.bz2  php-5.6.11.tar.bz2
apr-util-1.6.0.tar.gz    LAMP-php5.6.txt
Discuz_X2.5_SC_UTF8.zip  mysql-5.6.26.tar.gz
[root@localhost mnt]#Discuz_X2.5_SC_UTF8.zip -d /opt/dis  //把這個(gè)論壇包解壓到OPT底下
  creating: /opt/dis/utility/oldprg/uchome/
  inflating: /opt/dis/utility/oldprg/uchome/invite.php  
  inflating: /opt/dis/utility/oldprg/uchome/space.php  
  inflating: /opt/dis/utility/restore.php  
  inflating: /opt/dis/utility/update.php  

[root@localhost mnt]#cd /opt/dis
[root@localhost dis]#cp -r upload/ /usr/local/httpd/htdocs/bbs ////把網(wǎng)站所有的東西,復(fù)制到apache站點(diǎn)中起個(gè)名字bbs
[root@localhost bbs]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# ls  //查看有沒有這個(gè)頁(yè)面配置文件
bbs  index.php

16.去訪問(wèn)這個(gè)bbs頁(yè)面

Centos -7 .4LAMP架構(gòu)Discuz論壇
Centos -7 .4LAMP架構(gòu)Discuz論壇

17.給程序用戶提升權(quán)限

[root@localhost htdocs]# cd bbs/
[root@localhost bbs]# ls -l
總用量 76
-rw-r--r--.  1 root root 2603 10月 20 10:13 admin.php
drwxr-xr-x. 11 root root  163 10月 20 10:13 api
-rw-r--r--.  1 root root  727 10月 20 10:13 api.php
drwxr-xr-x.  2 root root   23 10月 20 10:13 archiver
drwxr-xr-x.  2 root root   90 10月 20 10:13 config
-rw-r--r--.  1 root root  922 10月 20 10:13 connect.php
-rw-r--r--.  1 root root  253 10月 20 10:13 cp.php
-rw-r--r--.  1 root root  106 10月 20 10:13 crossdomain.xml
drwxr-xr-x. 13 root root  216 10月 20 10:13 data
-rw-r--r--.  1 root root 5558 10月 20 10:13 favicon.ico
-rw-r--r--.  1 root root 2110 10月 20 10:13 forum.php
-rw-r--r--.  1 root root  823 10月 20 10:13 group.php
-rw-r--r--.  1 root root 1223 10月 20 10:13 home.php
-rw-r--r--.  1 root root 5448 10月 20 10:13 index.php
drwxr-xr-x.  5 root root   64 10月 20 10:13 install
-rw-r--r--.  1 root root 1040 10月 20 10:13 member.php
-rw-r--r--.  1 root root 1381 10月 20 10:13 misc.php
-rw-r--r--.  1 root root 1757 10月 20 10:13 plugin.php
-rw-r--r--.  1 root root  985 10月 20 10:13 portal.php
-rw-r--r--.  1 root root  582 10月 20 10:13 robots.txt
-rw-r--r--.  1 root root 1158 10月 20 10:13 search.php
drwxr-xr-x. 10 root root  168 10月 20 10:13 source
drwxr-xr-x.  6 root root   72 10月 20 10:13 static
drwxr-xr-x.  3 root root   38 10月 20 10:13 template
drwxr-xr-x.  6 root root   92 10月 20 10:13 uc_client
drwxr-xr-x. 13 root root  241 10月 20 10:13 uc_server
-rw-r--r--.  1 root root 1691 10月 20 10:13 userapp.php
[root@localhost bbs]# chown -R daemon ./config
[root@localhost bbs]# chown -R daemon ./data
[root@localhost bbs]# chown -R daemon ./uc_client
[root@localhost bbs]# chown -R daemon ./uc_server/data
[root@localhost bbs]# 
[root@localhost bbs]# ls -l
總用量 76
-rw-r--r--.  1 root   root 2603 10月 20 10:13 admin.php
drwxr-xr-x. 11 root   root  163 10月 20 10:13 api
-rw-r--r--.  1 root   root  727 10月 20 10:13 api.php
drwxr-xr-x.  2 root   root   23 10月 20 10:13 archiver
drwxr-xr-x.  2 daemon root   90 10月 20 10:13 config
-rw-r--r--.  1 root   root  922 10月 20 10:13 connect.php
-rw-r--r--.  1 root   root  253 10月 20 10:13 cp.php
-rw-r--r--.  1 root   root  106 10月 20 10:13 crossdomain.xml
drwxr-xr-x. 13 daemon root  216 10月 20 10:13 data
-rw-r--r--.  1 root   root 5558 10月 20 10:13 favicon.ico
-rw-r--r--.  1 root   root 2110 10月 20 10:13 forum.php
-rw-r--r--.  1 root   root  823 10月 20 10:13 group.php
-rw-r--r--.  1 root   root 1223 10月 20 10:13 home.php
-rw-r--r--.  1 root   root 5448 10月 20 10:13 index.php
drwxr-xr-x.  5 root   root   64 10月 20 10:13 install
-rw-r--r--.  1 root   root 1040 10月 20 10:13 member.php
-rw-r--r--.  1 root   root 1381 10月 20 10:13 misc.php
-rw-r--r--.  1 root   root 1757 10月 20 10:13 plugin.php
-rw-r--r--.  1 root   root  985 10月 20 10:13 portal.php
-rw-r--r--.  1 root   root  582 10月 20 10:13 robots.txt
-rw-r--r--.  1 root   root 1158 10月 20 10:13 search.php
drwxr-xr-x. 10 root   root  168 10月 20 10:13 source
drwxr-xr-x.  6 root   root   72 10月 20 10:13 static
drwxr-xr-x.  3 root   root   38 10月 20 10:13 template
drwxr-xr-x.  6 daemon root   92 10月 20 10:13 uc_client
drwxr-xr-x. 13 root   root  241 10月 20 10:13 uc_server
-rw-r--r--.  1 root   root 1691 10月 20 10:13 userapp.php

Centos -7 .4LAMP架構(gòu)Discuz論壇

18.直接下一步

Centos -7 .4LAMP架構(gòu)Discuz論壇

19.填上你的地址,數(shù)據(jù)庫(kù)名,數(shù)據(jù)庫(kù)用戶名,數(shù)據(jù)庫(kù)密碼,管理員密碼自己設(shè)置一個(gè)123,其他都是默認(rèn)的

Centos -7 .4LAMP架構(gòu)Discuz論壇

Centos -7 .4LAMP架構(gòu)Discuz論壇

20.輸入http://192.168.136.132/bbs直接就進(jìn)入論壇首頁(yè)了

Centos -7 .4LAMP架構(gòu)Discuz論壇

21.http://192.168.136.132/bbs/admin.php進(jìn)入后端,可以輸入你的密碼,用戶名

Centos -7 .4LAMP架構(gòu)Discuz論壇

23.在你的后端你可以隨意修改

Centos -7 .4LAMP架構(gòu)Discuz論壇

24.LAMP腳本

------------安裝Apache----下面兩個(gè)插件是httpd2.4以后的版本所需要-----
tar zxvf apr-1.6.2.tar.gz -C /opt
tar zxvf apr-util-1.6.0.tar.gz -C /opt
tar jxvf httpd-2.4.29.tar.bz2 -C /opt
mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util

yum -y install \
gcc \
gcc-c++ \
make \
pcre-devel \
expat-devel \
perl

cd httpd-2.4.29

./configure \
--prefix=/usr/local/httpd \
--enable-so \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi

make && make install

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd

#chkconfig: 35 85 21  //35級(jí)別自動(dòng)運(yùn)行  第85個(gè)啟動(dòng) 第21個(gè)關(guān)閉
#description: Apache is a World Wide Web server

chkconfig --add httpd //將httpd加入到SERVICE管理器

vi /usr/local/httpd/conf/httpd.conf  //到配置文件中配置參數(shù)
ServerName www.yun.com:80   //域名隨意改一個(gè)名字
Listen 192.168.136.132:80  //監(jiān)聽地址寫你本地的地址

ln -s /usr/local/httpd/conf/httpd.conf /etc/   //做個(gè)軟鏈接,下次直接就輸入vim /etc/httpd.conf就行
ln -s /usr/local/httpd/bin/* /usr/local/bin/   //做個(gè)軟鏈接,便于你的系統(tǒng)可以識(shí)別

systemctl stop firewalld.service
setenforce 0

httpd -t 
apachectl -t

service httpd start
netstat -anpt | grep 80

--------------以下是安裝MYSQL-----http://mirrors.sohu.com/mysql/---

yum install ncurses-devel autoconf cmake -y  //安裝環(huán)境包和Cmake工具包

cd /mnt
tar xzvf mysql-5.6.26.tar.gz -C /opt
cd /opt/mysql-5.6.26/
cmake  \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \  //指定安裝路徑
-DDEFAULT_CHARSET=utf8 \  //指定字符集
-DDEFAULT_COLLATION=utf8_general_ci \  //指定字符集默認(rèn)
-DEXTRA_CHARSETS=all \  //指定擴(kuò)展字符集
-DSYSCONFIDIR=/etc \  //指定配置文件目錄
-DMYSQL_DATADIR=/home/mysql/ \  //指定數(shù)據(jù)庫(kù)里的數(shù)據(jù)文件
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock  //定義sock文件連接數(shù)據(jù)庫(kù)文件

make && make install  //編譯計(jì)算機(jī)能識(shí)別的語(yǔ)言,安裝

cp support-files/my-default.cnf /etc/my.cnf  //把配置文件放進(jìn)去

cp support-files/mysql.server /etc/init.d/mysqld  //把配置文件放到啟動(dòng)腳本
chmod 755 /etc/init.d/mysqld       //添加執(zhí)行權(quán)限
chkconfig --add /etc/init.d/mysqld   //把服務(wù)添加到服務(wù)管理器中
chkconfig  mysqld --level 35 on       //35級(jí)別開啟

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile  //聲明調(diào)用mysql命令生成到系統(tǒng)環(huán)境變量中
source /etc/profile //啟動(dòng)系統(tǒng)環(huán)境變量
echo $PATH    //查看系統(tǒng)環(huán)境變量,命令有沒有被添加進(jìn)去

useradd -s /sbin/nologin mysql   //創(chuàng)建程序用戶,不讓它登錄本地控制臺(tái)
chown -R mysql:mysql /usr/local/mysql/  //提升路徑下所有用戶的權(quán)限

/usr/local/mysql/scripts/mysql_install_db \  //初始化數(shù)據(jù)庫(kù)
--user=mysql \   //數(shù)據(jù)庫(kù)用戶
--ldata=/var/lib/mysql \   //數(shù)據(jù)
--basedir=/usr/local/mysql \  //數(shù)據(jù)庫(kù)目錄
--datadir=/home/mysql  //數(shù)據(jù)庫(kù)存放目錄

vi  /etc/init.d/mysqld  //編輯數(shù)據(jù)庫(kù)文件

basedir=/usr/local/mysql     //指明路徑
datadir=/home/mysql     //指明數(shù)據(jù)庫(kù)存放位置

service mysqld start     //開啟數(shù)據(jù)庫(kù)
netstat -anpt | grep 3306   //查看監(jiān)聽端口

mysqladmin -u root -p password "abc123" //給root賬號(hào)設(shè)置密碼

---------以下安裝PHP------------
yum -y install \
gd \     //圖像化處理,
libpng \    //支持PNG圖片
libpng-devel \
pcre \
pcre-devel \
libxml2-devel \   //支持解析,標(biāo)簽性語(yǔ)言
libjpeg-devel      //支持jpg圖片格式

cd /mnt
tar xjvf php-5.6.11.tar.bz2 -C /opt   //php只是后臺(tái)的一個(gè)代碼,在后端
cd /opt/php-5.6.11/

./configure \
--prefix=/usr/local/php5 \  //指定安裝路徑
--with-gd \  //gd庫(kù),圖像化處理
--with-zlib \  //函數(shù)庫(kù)
--with-apxs2=/usr/local/httpd/bin/apxs \  //給apache提供功能性模塊
--with-mysql=/usr/local/mysql \  //關(guān)聯(lián)數(shù)據(jù)庫(kù)
--with-config-file-path=/usr/local/php5 \  //關(guān)聯(lián)PHP配置
--enable-mbstring   //功能性模塊加載

make && make install

cp php.ini-development /usr/local/php5/php.ini
ln -s /usr/local/php5/bin/* /usr/local/bin/
ln -s /usr/local/php5/sbin/* /usr/local/sbin/

vi /etc/httpd.conf //在apache配置文件中能加載PHP的功能模塊

AddType application/x-httpd-php .php   //加入PHP的配置文件
AddType application/x-httpd-php-source .phps

DirectoryIndex index.php index.html  //默認(rèn)首頁(yè)加上php

vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>

在網(wǎng)頁(yè)測(cè)試“http://192.168.80.182/index.php”

mysql -u root -p

CREATE DATABASE bbs;  //創(chuàng)建一個(gè)數(shù)據(jù)庫(kù)
GRANT all ON bbs.* TO 'bbsuser'@'192.168.102.166' IDENTIFIED BY 'admin123'; //提升權(quán)限給BBS數(shù)據(jù)庫(kù)當(dāng)中所有的表格,給bbsuser用戶,給所有終端可以登錄,設(shè)置密碼admin123
flush privileges; 

unzip /mnt/Discuz_X2.5_SC_UTF8.zip -d /opt/dis
cd /opt/dis
cp -r upload/ /usr/local/httpd/htdocs/bbs  //把網(wǎng)站所有的東西,復(fù)制到apache站點(diǎn)中起個(gè)名字bbs

chown -R daemon ./config  //給daemon這個(gè)程序用戶提升權(quán)限
chown -R daemon ./data
chown -R daemon ./uc_client
chown -R daemon ./uc_server/data

--------下面測(cè)試數(shù)據(jù)庫(kù)工作是否正常-----
mysql -u root -p

CREATE DATABASE sky;
GRANT all ON sky.* TO 'skyuser'@'%' IDENTIFIED BY 'admin123';
flush privileges; 

<?php
$link=mysql_connect('192.168.80.193','skyuser','admin123');
if($link) echo "<h2>Success!!</h2>";
else echo "Fail!!";
mysql_close();
?>

以上就是我們的全部?jī)?nèi)容了,要源碼包一定要私信我

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI