一、选择要安装的版本
Release Notes for Zabbix 5.0.39
二、准备环境
1、 准备新服务器
2、关闭防火墙,关闭selinu
三、下载zabbix yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum makecache
1、安装Zabbix server、前端、agent
yum install zabbix-server-mysql zabbix-agent
2、安装Zabbix前端启用红帽软件集合
yum install centos-release-scl
3、编辑文件 /etc/yum.repos.d/zabbix.repo 并启用 zabbix-frontend 存储库。
4、安装Zabbix前端软件包。
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
四、安装mysql
1、yum安装mysql 并启动
yum -y install mysql-server
systemctl start mysqld
2、修改密码
mysqladmin -p"`awk '/temporary password/{p=$NF}END{print p}' /var/log/mysqld.log`" password 'Tph@123.com'
3、创建zabbix库并授权
4、导入数据
五、配置 server 端
[root@new ~]# cd /etc/zabbix/
1、备份及其编辑配置文件
[root@new zabbix]# cp zabbix_server.conf{,.bak}
[root@new zabbix]# vim zabbix_server.conf
2、修改
DBHost=192.168.145.163 | #数据库对外的主机 |
DBName=zabbix | #数据库名称 |
DBUser=zabbix | #数据库用户 |
DBPassword=keer | #数据库密码 |
ListenPort=10051 | #默认监听端口 |
SourceIP=172.16.147.153 | #发采样数据请求的IP |
DBPort=3306 | #数据库启动端口 |
六、启动zabbix
1、启动
[root@new ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@new ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
2、查看端口
3、用nginx启动zabbix
修改配置文件
[root@new ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
将apache改为nginx,并且修改时区
修改权限
chown .nginx /var/opt/rh/rh-php72/lib/php/session/
chown nginx.nginx -R /etc/zabbix/web/
重启
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
七、安装客户端 agent
1)安装 zabbix
[root@new ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@new ~]# yum clean all
[root@new ~]# yum install zabbix-agent zabbix-sender -y
2)修改配置文件
[root@new ~]# cd /etc/zabbix/
[root@new ~]# cp zabbix_agentd.conf{,.bak}
Server=192.168.145.163 | #指明服务器是谁 |
ListenPort=10050 | #自己监听的端口 |
ListenIP=0.0.0.0 | #自己监听的地址,0.0.0.0表示本机所有地址 |
StartAgents=3 | #优化时使用的 |
ServerActive=192.168.145.163 | 主动监控时的服务器 |
Hostname=new server | #自己能被server端识别的名称 |
3、启动查看端口
systemctl start zabbix-agent.service
ss -ntul |grep 10050