The official zabbix source is replaced by Alibaba cloud's zabbix source, one click script.

Keywords: Linux Zabbix RPM yum MySQL

When zabbix is installed suddenly recently, it always reports an error, such as:

(24/27): t1lib-5.1.2-14.el7.x86_64.rpm                                                       | 166 kB  00:00:00     
zabbix-web-4.4.6-1.el7.noarch. FAILED   ==================================-                  ] 347 kB/s |  11 MB  00:00:15 ETA 
http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-web-4.4.6-1.el7.noarch.rpm: [Errno 14] curl#18 - "transfer closed with 2988713 bytes remaining to read":15 ETA 
Trying other mirror.
warning: /var/cache/yum/x86_64/7/zabbix/packages/zabbix-web-mysql-4.4.6-1.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY  11 MB  00:15:26 ETA 
Public key for zabbix-web-mysql-4.4.6-1.el7.noarch.rpm is not installed
(25/27): zabbix-web-mysql-4.4.6-1.el7.noarch.rpm                                             |  11 kB  00:00:01     
zabbix-server-mysql-4.4.6-1.el FAILED   ==================================                   ] 7.9 kB/s |  11 MB  00:11:28 ETA 
http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-server-mysql-4.4.6-1.el7.x86_64.rpm: [Errno 14] curl#18 - "transfer closed with 2488565 bytes remaining to read"
Trying other mirror.

Error downloading packages:
  zabbix-web-4.4.6-1.el7.noarch: [Errno 256] No more mirrors to try.
  zabbix-server-mysql-4.4.6-1.el7.x86_64: [Errno 256] No more mirrors to try. 

This is actually a problem on the Internet. If I surf the Internet in a scientific way, it's OK. But once I use the domestic network, I report an error. So I can only study it and change it to Alibaba cloud's zabbix source. Very powerful.

It takes several steps to install what I found online. I haven't found anything convenient on Alibaba cloud, so I have to write a script and share it.

#!/bin/bash
echo -e "Please give the zabbix Version number, 4 recommended.x Version of  \033[31musage: ./zabbix_aliyun.sh 4.0|4.4|4.5 \033[0m"
echo "For example, to install 4.4 Version, writing on the command line ./zabbix_aliyun.sh 4.4"
if [ -z $1 ];then
    exit
fi
VERSION=$1
if [ -f /etc/yum.repos.d/zabbix.repo ];then
    rm -rf /etc/repos.d/zabbix.repo
fi
rpm -qa | grep zabbix-release && rpm -e zabbix-release
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/$VERSION/rhel/7/x86_64/zabbix-release-$VERSION-1.el7.noarch.rpm
sed -i "s@zabbix/.*/rhel@zabbix/$VERSION/rhel@g" /etc/yum.repos.d/zabbix.repo
sed -i 's@repo.zabbix.com@mirrors.aliyun.com/zabbix@g' /etc/yum.repos.d/zabbix.repo
[ $? -eq 0 ] && echo "Alicloud's zabbix Source replaced successfully" || exit 1
yum clean all
yum makecache fast

Posted by dniezby on Mon, 11 May 2020 07:13:47 -0700