三台主机搭建lnmp环境、部署zabbix

环境说明

系统平台 IP 服务
CentOS7
redhat7
192.168.102.11 nginx
CentOS7
redhat7
192.168.102.12 mysql
CentOS7
redhat7
192.168.102.13 php

1、lnmp平台软件安装顺序: nginx --> mysql --> php/
2、关闭防火墙和selinux
3、配置网络源
4、准备好软件包
nginx
mysql
php

操作

安装

  • 192.168.102.11
//安装开发工具包 ‘Development Tools’
[root@server ~]# yum -y groupinstall 'Development Tools'

//安装依赖包
[root@server ~]# yum -y install openssl-devel pcre-devel openssl-devel gd-devel gcc gcc-c++ epel-release


//创建nginx的用户和组
[root@server ~]# groupadd -g  1000 nginx
[root@server ~]# useradd -M -s /sbin/nologin -g 1000 -u 1000 nginx
[root@server ~]# id nginx
uid=1000(nginx) gid=1000(nginx) groups=1000(nginx)

//创建日志存放目录
[root@server ~]# mkdir  -p /var/log/nginx/
[root@server ~]# chown -R nginx.nginx /var/log/nginx/

//编译安装nginx
[root@server ~]# tar -xf nginx-1.14.0
[root@server ~]# cd nginx-1.14.0/
[root@server nginx-1.14.0]# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-debug \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log
[root@server nginx-1.14.0]# make && make install


//将路径写入环境变量
[root@server ~]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
[root@server ~]# . /etc/profile.d/nginx.sh 

//安装后检查配置是否有错
[root@server nginx-1.14.0]# nginx -t
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


//启动nginx
[root@server nginx-1.14.0]# nginx
[root@server ~]# ss -antl
State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN     0      128          *:22                       *:*                  
LISTEN     0      100    127.0.0.1:25                       *:*                  
LISTEN     0      128         :::80                      :::*                  
LISTEN     0      128         :::22                      :::*                  
LISTEN     0      100        ::1:25                      :::*

安装mysql

  • 192.168.102.12
//安装依赖包
[r
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值