zabbix+nginx+mysql部署(centos7)

zabbix-server 部署

zabbix官网

#下载zabbix仓库 zabbix-release-5.0-1.el7.noarch.rpm
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

#安装zabbix-服务器和代理
yum -y install zabbix-server-mysql zabbix-agent

#安装zabbix前端
yum -y install centos-release-scl
#编辑文件/etc/yum.repos.d/zabbix.repo并启用zabbix-frontend存储库。
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...

#安装zabbix前端软件包
yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
安装mysql
#下载mysql源仓库
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

#安装源仓库
yum -y install mysql80-community-release-el7-3.noarch.rpm

#设置安装版本
vim /etc/yum.repos.d/mysql-community.repo
关闭8.0版本 enable=0     开启5.7版本 enable=1

#安装mysql
yum -y install mysql-community-server

#启动mysql
systemctl restart mysqld

#查看初始密码
grep password /var/log/mysqld.log

#更改密码
mysqladmin -uroot -p'初始密码' password '1New_password'

#登陆MySQL
mysql -uroot -p'1New_password'

#创建zabbix库
create database zabbix character set utf8 collate utf8_bin;

#创建用户
create user zabbix@localhost identified by '1Password.';

#授权该账户
grant all privileges on zabbix.* to zabbix@localhost;
quit;
导入数据并进行前端设置
#导入初始架构和数据
vim /usr/share/doc/zabbix-server-mysql-5.0.10/create.sql.gz
use zabbix;  #在第一行添加
zcat /usr/share/doc/zabbix-server-mysql-5.0.10/create.sql.gz | mysql -uzabbix -p'1Password.'	

#配置zabbix服务器数据库
vim /etc/zabbix/zabbix_server.conf
DBPassword=1Password.   #password为授权用户密码

#为zabbix前端配置php
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
listen 80;
server_name 192.168.64.137    #zabbix服务端的IP地址

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx   #添加nginx
#添加时区
echo php_value[date.timezone] = Asia/Shanghai >> /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf   #更改时区
启动服务
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

使用浏览器访问: 192.168.64.137

zabbix-client 部署
#关闭防火墙及selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
#下载zabbix仓库
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
#安装zabbix-agent程序
yum -y install zabbix-agent
#修改配置问价
vim /etc/zabbix/zabbix_agentd.conf
Hostname=web  #主机名
Server=192.168.64.137  #被动模式zabbix-server-ip
ServerActive=192.168.64.137  #主动模式zabbix-server-ip
#启动程序并开机自启
systemctl restart zabbix-agent
systemctl enable zabbix-agent
#查看程序是否启动
netstat -tnlp   #看到10051端口即为程序启动
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值