今天测试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
文章仅为记录,脚本见下一篇文章