更换zabbix源为阿里云的源

oakcdrom0条评论 1,721 次浏览

问题描述

最近打算安装zabbix4.4,但是每次安装都出现如下错误:

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.

问题解决

初步判断可能是源出现问题,更换阿里云的源即可解决.为了省事,从其他作者哪里借用个脚本.

#!/bin/bash
echo -e "请给出要安装的zabbix版本号,建议使用4.x的版本  \033[31musage:./zabbix_aliyun.sh 4.0|4.4|4.5 \033[0m"
echo "例如要安装4.4版本,在命令行写上 ./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 "阿里云的zabbix源替换成功" || exit 1
yum clean all
yum makecache fast

发表评论

? razz sad evil ! smile oops grin eek shock ??? cool lol mad twisted roll wink idea arrow neutral cry mrgreen