LNMP+zabbix服务搭建

本文档详述了在Linux环境下如何部署LNMP(Nginx、MySQL、PHP)服务,并集成Zabbix进行监控。首先关闭防火墙,然后逐个安装Nginx、MySQL、PHP,配置相关服务,确保它们可以正常运行。接着,设置了PHP的配置参数,以满足Zabbix的系统要求。最后,创建Zabbix数据库,导入数据,并启动Zabbix服务。整个过程包含了各个步骤的配置细节,适合初学者参考。
摘要由CSDN通过智能技术生成

环境部署

服务端:192.168.35.100

客户端:192.168.35.101

服务端安装配置

关闭防火墙

[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
--2020-01-31 13:19:13--  http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
正在解析主机 nginx.org (nginx.org)... 62.210.92.35, 95.211.80.227, 2001:1af8:4060:a004:21::e3
正在连接 nginx.org (nginx.org)|62.210.92.35|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:4680 (4.6K) [application/x-redhat-package-manager]
正在保存至: “nginx-release-centos-7-0.el7.ngx.noarch.rpm”

100%[====================================>] 4,680       1.29KB/s 用时 3.5s   

2020-01-31 13:19:17 (1.29 KB/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

(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)打开网页访问下

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 USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):                      #回车
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y                         #设置密码 
New password:                       #abc123
Re-enter new password:                    #abc123
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n                 #不删除匿名用户
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n              #允许远程登录
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值