yum 安装zabbix-agent报错:transfer closed with 333939 bytes remaining to read (更换源为阿里云源)

    今天测试shell脚本安装zabbix-agent并修改zabbix-agent.conf配置文件,在下载zabbix-agent时报错:transfer closed with 333939 bytes remaining to read !

    由于起初使用的是zabbix的官方源,官方源地址为:https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

    替换为阿里云源:rpm -ivh https://mirrors.aliyun.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

    各自根据安装的zabbix版本替换!

    以下为替换过程,参考:https://www.cnblogs.com/syscal/p/12461620.html

   下载repo文件

 

[root@localhost ~]# wget http://mirrors.aliyun.com/repo/Centos-7.repo


    备份并替换系统的repo文件

   [root@localhost ~]# cp Centos-7.repo /etc/yum.repos.d/
   [root@localhost ~]# cd /etc/yum.repos.d/
   [root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak 
   [root@localhost ~]# mv Centos-7.repo CentOS-Base.repo


 执行yum源更新命令

[root@localhost ~]# yum clean all
 
[root@localhost ~]# yum makecache
 
[root@localhost ~]# yum update

更换zabbix国内源

vim /etc/yum.repos.d/zabbix.repo


如需安装4.0:将下面改为3.0改成4.0即可

[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/\$basearch/
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=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1


添加gpgkey

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX


添加之后即可使用,更新源

yum makecache -y

 

文章仅为记录,脚本见下一篇文章

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值