华为云yum仓库拉取更新缓慢
问题
今天更新centos7老古董,发现执行常规的yum makecache都是稳定在1.3M/s
其他云都是满速度,令人奇怪🤔
查找原因
1.首先,查看之前管理员配置的yumrepo,发现CentOS-Base.repo是配置的阿里云的。
于是换成华为云的:
参考链接:https://mirrors.huaweicloud.com/mirrorDetail/5ea14ecab05943f36fb75ee5?mirrorName=centos&catalog=os
cp -a /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-7-anon.repo
发现更新完还是速度一样。继续探索
2.换成自己云还不行的话,直觉告诉我,需要去文档找找
果不其然,他们自己这边做了限制。需要开通终端节点,相当于是免费的内网,但是配置些许繁琐。
解决
参考链接:
https://support.huaweicloud.com/usermanual-mirrors/topic_0000002022764206.html
按照以上开通之后,加了内网白名单,替换掉https和repo地址之后,速度果然上来了。
搞定!
最后贴一下两个常用repo
CentOS-Base.repo
{root@hrt-jk}# cat CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.huaweicloud.com
baseurl=http://repo.myhuaweicloud.com/centos/$releasever/os/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://repo.myhuaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.huaweicloud.com
baseurl=http://repo.myhuaweicloud.com/centos/$releasever/updates/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://repo.myhuaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.huaweicloud.com
baseurl=http://repo.myhuaweicloud.com/centos/$releasever/extras/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://repo.myhuaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.huaweicloud.com
baseurl=http://repo.myhuaweicloud.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=https://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://repo.myhuaweicloud.com/centos/RPM-GPG-KEY-CentOS-7
epel.repo
cat epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://repo.myhuaweicloud.com/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://repo.myhuaweicloud.com/epel/7/$basearch/debug
#metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://repo.myhuaweicloud.com/epel/7/SRPMS
#metalink=https://mirrors.fedoraproject.org/#metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
其他仓库以此类推,不再一一列举。
欢迎关注我的公众号“辣个男人Devin”,新鲜技术文章第一时间推送。