项目环境:
服务端:192.168.200.40
客户端:192.168.200.60
服务端安装配置
关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
一、LNMP安装环境
1、安装nginx1.16
(1)从官网上下载
root@localhost ~]# wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
--2021-04-01 11:13:37-- http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
正在解析主机 nginx.org (nginx.org)... 52.58.199.22, 3.125.197.172, 2a05:d014:edb:5702::6, ...
正在连接 nginx.org (nginx.org)|52.58.199.22|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:4680 (4.6K) [application/x-redhat-package-manager]
正在保存至: “nginx-release-centos-7-0.el7.ngx.noarch.rpm”
100%[======================>] 4,680 --.-K/s 用时 0s
2021-04-01 11:13:38 (400 MB/s) - 已保存 “nginx-release-centos-7-0.el7.ngx.noarch.rpm” [4680/4680])
(2)手动创建nginx yum安装源
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
(3)重新加载
[root@localhost ~]# yum list
如果出现以下问题:
[root@localhost ~]# yum list
已加载插件:fastestmirror, langpacks
/var/run/yum.pid 已被锁定,PID 为 17043 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
另一个应用程序是:PackageKit
内存:162 M RSS (649 MB VSZ)
已启动: Thu Apr 1 11:10:49 2021 - 03:31之前
状态 :睡眠中,进程ID:17043
将进程杀掉即可:
[root@localhost ~]# kill -5 17043
(4)安装nginx
[root@localhost ~]# yum install nginx -y
(5)开启服务
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# netstat -ntap | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 108485/nginx: maste
[root@localhost ~]# systemctl enable nginx #设为开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
(6)打开网页访问 http://192.168.200.40

2、安装mysql 5.7
(1)安装服务
[root@localhost ~]# yum install -y mariadb-server mariadb
(2)开启服务
[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
(3)进行设置
[root@localhost ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION