LNMP

安装Nginx服务

systemctl stop firewalldsystemctl disable firewalldsetenforce 0

1、安装依赖包
yum -y install pcre-devel zlib-devel gcc gcc-c++ make
2、创建运行用户
useradd -M-s /sbin/nologin nginx
3、编译安装
cd /opt
tar zxvf nginx-1.12.0.tar.gz -C /opt/
cd nginx-1.12.0/
./ configure l
--prefix=/usr/ local/nginx l--user=nginx l
--group=nginx l
--with-http_stub_status_module
make && make install
4、优化路径
ln -s /usr/ local/nginx/sbin/nginx /usr/ local/sbin/
5、添加Nginx系统服务
vim /lib/systemd/system/nginx.service
[Unit]
Description=nginxAfter=network.target[ Service]
Type=forking
PIDFile=/usr / local/nginx/ logs/ nginx.pidExecstart=/usr/ local/nginx/sbin/ nginxExecReload=/bin/kill -s HUP $MAINPIDExecStop=/bin/kill -s QUIT $MAINPIDPrivateTmp=true
[ Install]
wantedBy=multi-user.target

chmod 754/ lib/ systemd/ system/nginx.service
systemctl start nginx.service
systemctl enable nginx.service

1.png

2.png 3.png 4.png 5.png 6.png

7.png

8.1.png

8.2.png

8.3.png

8.png 安装Nginx服务

安装 MySQL服务

1、安装Mysql环境依赖包yum -y install \
ncurses l
ncurses-devel lbison l
cmake
2、创建运行用户
useradd -M-s / sbin/nologin mysql
3、编译安装
cd /opt
tar zxvf mysql-boost-5.7.20.tar.gz
cd /opt/mysql-5.7.20/
cmake \
-DCMAKE INSTALLPREFIX=/usr/local/mysql \
-DMYSQL UNIX ADDR=/usr/local/mysql/mysql.sock \
-DSYsCONFDIR=/etc \
-DSYSTEMD PID_ DIR=/usr/local/mysql \
-DDEFAULT CHARSET=utf8\
-DDEFAULTCOLLATION=utf8_general_ci \
-DWITH EXTRA CHARSETS=all \
-DWITH INNOBASE STORAGE ENGINE=1 \
-DWITH ARCHIVESTORAGE_ ENGINE=1 \
-DWITHBLACKHOLE STORAGE ENGINE=1 \
-DWITHPERFSCHEMA STORAGE ENGINE=1 \
-DMYSQL DATADIR=/usr/local/mysql/data-DWITHBOOST=boost l
-DWITH_SYSTEMD=1
make & & make install
4、修改mysql配置文件vim /etc/my.cnf
[ client]
port = 3306
character-set-server=utf8
pid-file = /usr/ local/mysql/mysqld.pidsocket=/usr/ local/mysql/mysql.sock
bind-address = 0.0.0. 0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODBmax_allowed packet=16M
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 DAT
E,ERROR_FOR_DIVISION_BY_ZERO,PIPES_ AS_CONCAT,ANSI QUOTES
5、更改mysql安装目录和配置文件的属主属组
chown -R mysql:mysql /usr/ local/mysql/chown mysql:mysql /etc/my. cnf
6、设置路径环境变量
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH'>>/etc/profilesource /etc/profile
7、初始化数据库
cd /usr/local/mysql/bin/./mysqld l
--initialize-insecure \—-user=mysql \
--basedir=/usr/ local/mysql \--datadir=/usr/ local/mysql/data
8、添加mysqld系统服务
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/systemctl daemon-reload
systemctl start mysqld.servicesystemctl enable mysqld

9、修改mysql 的登录密码
mysqladmin -u root -p password "abc123"
10、授权远程登录
mysql -u root -p

安装配置PHP解析环境

1、安装环境依赖包
yum -y install gd l
libjpeg libjpeg-devel llibpng libpng-devel l
freetype freetype-devel \libxml2 libxml2-devel lzlib zlib-devel l
curl curl-devel l
openssl openssl-devel2、编译安装
cd /opt
tar jxvf php-7.1.10.tar.bz2cd php-7.1.10