

环境准备
一台zabbix-server
175.24.227.179
一台zabbix-agent
154.17.29.27
Server建议最低配置2C2G
zabbix-server搭建
关闭防火墙
systemctl disable --now firewalld
更新yum源
yum update
下载zabbix安装包
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
下载安装Centos_scl软件合集
yum install centos-release-scl
启用仓库[zabbix-frontend]
编辑配置文件 /etc/yum.repos.d/zabbix.repo
enabled=1
安装Zabbix server,Web前端,agent,mysql文件
yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql-scl zabbix-apache-conf-scl
安装数据库
yum install mariadb-server
systemctl enable --now mariadb
安全初始化数据库,设置root密码为123456
mysql_secure_installation
登录数据库,创建表和用户,设置字符集(方便显示中文)
mysql -uroot -p123456
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by '123456';
grant all privileges on zabbix.* to zabbix@localhost;
导入初始架构和数据
zcat可以在不打开压缩包的情况下查看,通过管道导入zabbix数据库
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix
观察表格是否生成
mysql -uzabbix -p123456 zabbix -e "show tables";
为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=123456
为Zabbix前端配置PHP,更改时区
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
启动Zabbix server和agent进程
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
查看端口起来没
服务端是 10051
客户端是 10050
ss -ntl
直接在浏览器登录
格式:IP/zabbix
175.24.227.179/zabbix



点下一步设置完后登录
默认用户名密码
Admin
zabbix


Zabbix-agent搭建
安装zabbix-agent
yum -y isntall zabbix-agent
systemctl enable --now zabbix-agent
编辑/etc/zabbix/zabbix_agentd.conf
填写zabbix-server的IP
Server=175.24.227.179
重启服务
systemctl restart zabbix-agent.service
Web端配置
Configuration → Hosts → Create host
配置完看到绿了就正常了



