报错原因:主要是因为zabbix是国外的,国内访问不了国外的网络
解决方法:更换阿里云的镜像或者其他可以访问到的镜像地址
打开zabbix.repo
vim /etc/yum.repos.d/zabbix.repo
内容如下,修改baseurl部分,把zabbix源注释,添加阿里云(aliyun)的源
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/$basearch/ # 换成阿里云的yum源
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
#baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/ #换成阿里云的yum源
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
修改完成后执行
yum clean all
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent