您好,登錄后才能下訂單哦!
[root@localhost ~]# smbclient -L //192.168.100.23/ #訪問宿主機
Enter SAMBA\root's password:
OS=[Windows 10 Enterprise 17763] Server=[Windows 10 Enterprise 6.3]
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk 遠程管理
C$ Disk 默認共享
D$ Disk 默認共享
E$ Disk 默認共享
F$ Disk 默認共享
G$ Disk 默認共享
IPC$ IPC 遠程 IPC
LAMP Disk
LAMP-C7 Disk
LNMP Disk
share Disk
Users Disk
[root@localhost ~]# mkdir chen/ #創建掛載點
[root@localhost ~]# mount.cifs //192.168.100.23/LNMP chen/ #掛載
Password for root@//192.168.100.23/LNMP:
[root@localhost ~]# cd chen/
[root@localhost chen]# ls
mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
nginx-1.12.0.tar.gz php-7.1.10.tar.bz2
[root@localhost chen]# tar zxvf nginx-1.12.2.tar.gz -C /opt/
[root@localhost opt]# yum install gcc gcc-c++ pcre-devel zlib-devel -y
#c語言,c++語言,pcre語言,數據壓縮用的函數庫
已安裝:
gcc.x86_64 0:4.8.5-39.el7 gcc-c++.x86_64 0:4.8.5-39.el7
pcre-devel.x86_64 0:8.32-17.el7 zlib-devel.x86_64 0:1.2.7-18.el7
作為依賴被安裝:
cpp.x86_64 0:4.8.5-39.el7
glibc-devel.x86_64 0:2.17-292.el7
glibc-headers.x86_64 0:2.17-292.el7
kernel-headers.x86_64 0:3.10.0-1062.4.1.el7
libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.5-39.el7
作為依賴被升級:
glibc.x86_64 0:2.17-292.el7 glibc-common.x86_64 0:2.17-292.el7
libgcc.x86_64 0:4.8.5-39.el7 libgomp.x86_64 0:4.8.5-39.el7
libstdc++.x86_64 0:4.8.5-39.el7 zlib.x86_64 0:1.2.7-18.el7
[root@localhost opt]# useradd -M -s /sbin/nologin nginx #創建nginx用戶,不指定家目錄,不讓它登錄本地控制臺
[root@localhost opt]# id nginx
uid=1001(nginx) gid=1001(nginx) 組=1001(nginx)
[root@localhost opt]# cd nginx-1.12.2/
[root@localhost nginx-1.12.2]# ls
auto CHANGES.ru configure html man src
CHANGES conf contrib LICENSE README
[root@localhost nginx-1.12.2]# ./configure \ #執行腳本,安裝組件
--prefix=/usr/local/nginx \ #指定路徑
--user=nginx \ #指定用戶
--group=nginx \ #指定組
--with-http_stub_status_module #狀態統計模塊
[root@localhost nginx-1.12.2]# make #編譯
[root@localhost nginx-1.12.2]# make install #編譯安裝
[root@localhost nginx-1.12.2]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ #做個軟鏈接讓系統能識別nginx的命令
[root@localhost nginx-1.12.2]# nginx -t #檢查nginx配置語法有沒有錯誤
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost logs]# nginx #開啟nginx服務
[root@localhost nginx-1.12.2]# netstat -ntap | grep nginx #查看nginx端口
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 8878/nginx: master
[root@localhost nginx-1.12.2]# systemctl stop firewalld.service #關閉防火墻
[root@localhost nginx-1.12.2]# setenforce 0 #關閉增強功能
[root@localhost init.d]# cd /usr/local/nginx/logs/
[root@localhost logs]# ls
access.log error.log nginx.pid
[root@localhost logs]# cat nginx.pid #查看nginx的進程號,我們關閉,啟動,都是靠這個進程號
8878
[root@localhost nginx-1.12.2]# cd /etc/init.d/ #到系統腳本中
[root@localhost init.d]# vim nginx #添加nginx腳本
#!/bin/bash
#chkconfig: - 99 20 #注釋信息
#description: Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx" #這個變量,指向我的命令文件
PIDF="/usr/local/nginx/logs/nginx.pid" #這個變量,指向nginx的進程號
case "$1" in
start)
$PROG
;;
stop)
kill -s QUIT $(cat $PIDF)
;;
restart)
$0 stop
$0 start
;;
reload)
kill -s HUP $(cat $PIDF)
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
[root@localhost logs]# chmod +x /etc/init.d/nginx #添加執行權限
[root@localhost logs]# chkconfig --add nginx #添加nginx
[root@localhost logs]# service nginx stop #關閉nginx
[root@localhost logs]# service nginx start #開啟nginx
[root@localhost logs]# netstat -ntap | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9185/nginx: master
[root@localhost logs]# cd ~
[root@localhost ~]# yum -y install \
gcc \ #c語言
gcc-c++ \ #c++語言
ncurses \
ncurses-devel \ #控制終端屏幕顯示的庫
bison \ #語法分析工具
cmake #cmake工具
[root@localhost ~]# useradd -s /sbin/nologin mysql #創建程序性用戶
[root@localhost ~]# cd chen/
[root@localhost chen]# ls
mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
nginx-1.12.0.tar.gz php-7.1.10.tar.bz2
[root@localhost chen]# tar zxvf mysql-boost-5.7.20.tar.gz -C /opt #解壓縮到opt底下
[root@localhost chen]# cd /opt/
[root@localhost opt]# cd mysql-5.7.20/
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ #安裝路徑
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ #定義sock文件連接數據庫文件
-DSYSCONFDIR=/etc \ #配置文件目錄
-DSYSTEMD_PID_DIR=/usr/local/mysql \ #PID文件目錄
-DDEFAULT_CHARSET=utf8 \ #指定字符集
-DDEFAULT_COLLATION=utf8_general_ci \ #指定字符集默認
-DWITH_INNOBASE_STORAGE_ENGINE=1 \ #存儲引擎,以下三個都是
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \ #數據庫數據文件目錄
-DWITH_BOOST=boost \ #底層運行庫
-DWITH_SYSTEMD=1 #主從參數
[root@localhost mysql-5.7.20]#make #編譯
[root@localhost mysql-5.7.20]#make install #編譯安裝
[root@localhost mysql-5.7.20]#cd /usr/local/
[root@localhost local]# chown -R mysql:mysql mysql/ #提升mysql權限,屬祝,屬組
[root@localhost local]# cd /opt/mysql-5.7.20/
[root@localhost mysql-5.7.20]# vim /etc/my.cnf ##調整配置文件
[client] ##客戶端
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysql] ##客戶端
port = 3306
default-character-set=utf8
socket = /usr/local/mysql/mysql.sock
[mysqld] ##服務器
user = mysql ##用戶
basedir = /usr/local/mysql ##設置mysql的安裝目錄
datadir = /usr/local/mysql/data ##設置mysql數據庫的數據的存放目錄
port = 3306 ##設置3306端口
character_set_server=utf8 ##中文字符集
pid-file = /usr/local/mysql/mysqld.pid ##pid文件路徑
socket = /usr/local/mysql/mysql.sock ##sock文件路徑
server-id = 1 ##主從參數
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES
[root@localhost local]# echo 'PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
#設置環境變量,使系統能識別bin和lib下的所有命令
[root@localhost local]# echo 'export PATH' >> /etc/profile
#全局變量
[root@localhost local]# source /etc/profile #重新啟動系統環境變量
[root@localhost local]# cd /usr/local/mysql/
bin/mysqld \
--initialize-insecure \ #初始化
--user=mysql \ #指定用戶
--basedir=/usr/local/mysql \ #指定安裝目錄
--datadir=/usr/local/mysql/data #數據庫數據文件目錄
[root@localhost mysql]# cp usr/lib/systemd/system/mysqld.service /lib/systemd/system/
#把mysql啟動腳本放到系統中可以systemctl可以管理
[root@localhost mysql]# systemctl start mysqld.service
[root@localhost mysql]# netstat -ntap | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 73971/mysqld
[root@localhost mysql]# mysqladmin -u root -p password #一開始是空的密碼,可以設置abc123
Enter password:
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
[root@localhost mysql]# mysql -u root -p
Enter password:
yum install -y \
libjpeg \ ##jpeg圖片格式和開發包
libjpeg-devel \
libpng libpng-devel \ ##png圖片和開發包
freetype freetype-devel \ ##字體庫
libxml2 \ ##xml文件庫
libxml2-devel \
zlib zlib-devel \ ##壓縮庫
curl curl-devel \ ##支持數據文件下載工具
openssl openssl-devel ##安全訪問連接
[root@localhost chen]# cd chen/
[root@localhost chen]# tar zxvf php-7.1.20.tar.gz -C /opt/
[root@localhost chen]# cd /opt/
[root@localhost opt]# ls
mysql-5.7.20 nginx-1.12.2 php-7.1.20 rh
[root@localhost opt]# cd php-7.1.10/
[root@localhost php-7.1.10]# ./configure
--prefix=/usr/local/php ##安裝路徑
--with-mysql-sock=/usr/local/mysql/mysql.sock ##連接文件建立通信橋梁
--with-mysqli ##客戶端支持庫
--with-zlib ##壓縮
--with-curl ##支持上傳下載功能
--with-gd ##gd圖像支持圖片處理庫
--with-jpeg-dir ##jpeg
--with-png-dir ##png
--with-freetype-dir ##字體
--with-openssl ##安全訪問連接
--enable-fpm ##fpm支持動態請求模塊
--enable-mbstring ##支持多字節的字符串
--enable-xml ##xml文件
--enable-session ##session支持會話
--enable-ftp ##ftp服務
--enable-pdo ##驅動連接管理
--enable-tokenizer ##PHP自帶函數
--enable-zip ##zip壓縮包
[root@localhost php-7.1.20]# make
[root@localhost php-7.1.20]# make install
www.conf 擴展配置文件
cp php.ini-development /usr/local/php/lib/php.ini #把核心文件復制一份出來工作目錄底下
vim /usr/local/php/lib/php.ini
1170 行mysql.default_socket= /usr/local/mysql/mysql.sock
#添加mysql sock路徑
939 行 date.timezone = Asia/Shanghai
#添加時區,上海的時區
/usr/local/php/bin/php -m #驗證安裝模塊
#配置及優化FPM模塊
[root@localhost php-7.1.20]# cd /usr/local/php/etc/
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
#開啟監控PID
[root@localhost etc]# vim php-fpm.conf
pid = run/php-fpm.pid
#擴展的文件中我們復制一份出來
[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# ls
www.conf.default
[root@localhost php-fpm.d]# cp www.conf.default www.conf
#啟動用sbin配置文件指向lib下的配置文件
[root@localhost php-fpm.d]# /usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
[root@localhost php-fpm.d]# netstat -natp | grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 92879/php-fpm: mast
[root@localhost php-fpm.d]# ln -s /usr/local/php/bin/* /usr/local/bin/
[root@localhost php-fpm.d]#cd /usr/local/nginx/conf/
[root@localhost php-fpm.d]#vim nginx.conf
#讓nginx能支持PHP功能
#指定站點目錄路徑
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
[root@localhost conf]# systemctl stop nginx.service
[root@localhost conf]# systemctl start nginx.service
[root@localhost conf]# cd /usr/local/nginx/html/
[root@localhost html]# ls
50x.html index.html
[root@localhost html]# mv index.html index.php
[root@localhost html]#vim index.php
#把原來的內容刪掉,寫PHP的網頁
<?php
phpinfo();
?>
[root@localhost html]# mysql -u root -p
mysql> CREATE DATABASE bbs; #創建數據庫
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY 'admin123'; #提權數據庫當中的所有表格用戶bbsuser為管理員設定密碼
mysql> GRANT all ON bbs.* TO 'bbsuser'@'localhost' IDENTIFIED BY 'admin123';
mysql> flush privileges; #刷新數據庫
mysql> quit
[root@localhost opt]# cd ~
mount.cifs //192.168.100.23/LNMP /opt/
[root@localhost ~]# cd /opt/
[root@localhost opt]# ls
Discuz_X3.4_SC_UTF8.zip nginx-1.12.0.tar.gz php-7.1.10.tar.bz2
mysql-boost-5.7.20.tar.gz nginx-1.12.2.tar.gz php-7.1.20.tar.gz
[root@localhost opt]# unzip Discuz_X3.4_SC_UTF8.zip -d /mnt/
[root@localhost opt]# cd /mnt/
[root@localhost mnt]# ls
dir_SC_UTF8 說明.htm
[root@localhost mnt]# cd dir_SC_UTF8/
[root@localhost dir_SC_UTF8]# ls
readme upload utility
[root@localhost dir_SC_UTF8]# cp -r upload/ /usr/local/nginx/html/bbs#復制/opt目錄里的內容到html站點的bbs目錄中
[root@localhost dir_SC_UTF8]# cd /usr/local/nginx/html/bbs/ ##進入bbs站點目錄
[root@localhost bbs]# chown -R root:nginx ./config/
chown -R root:nginx ./data/
chown -R root:nginx ./uc_client/
chown -R root:nginx ./uc_server/
chmod -R 777 ./config/
chmod -R 777 ./data/
chmod -R 777 ./uc_client/
chmod -R 777 ./uc_server/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。