1.获取本机ip?ifconfig ens33 |awk 'NR==2{print $2}'??172.18.19.131
2.关闭防火墙?sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config??systemctl disable --now firewalld
3.获取zabbix下载源?rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
4.更换yum源
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#'
5.清空原来的源缓存
yum clean all
6.安装zabbix数据库和采集端
yum install zabbix-server-mysql zabbix-agent -y
7.安装版本兼容工具
yum install centos-release-scl -y
8.修改前端源配置
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
9.安装前端环境
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
10.安装所需的数据库
yum install mariadb-server -y
11.创建数据库以及修字符集,创建数据库用户,用户授权,刷新授权
create database zabbix character set utf8 collate utf8_bin;?
create user zabbix@localhost identified by '123456';
grant all privileges on zabbix.* to zabbix@localhost;
flush privileges;
12.导入数据库
?zcat /usr/share/doc/zabbix-server-mysql-5.0.23/create.sql.gz |mysql -uzabbix -p zabbix
13.修改服务端数据库用户密码
vim /etc/zabbix/zabbix_server.conf?
grep '^DBPa' /etc/zabbix/zabbix_server.conf (查看密码是否配置成功)
14.修改php配置文件的时区
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
15.启动zabbix服务
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
16.访问zabbix?http://172.18.19.131/zabbix
17.测试与客户端是否连通(须部署客户端)
yum install zabbix-get -y
zabbix_get -s '172.18.19.132' -p 10050 -k 'system.hostname'