centos8 yum失败完美解决

CentOS8跟换阿里源时使用yum makecache时下载巨慢,最后失败的解决办法

froatmop  于 2020-11-20 23:00:01 发布  1504  收藏 3
文章标签: linux centos
版权
CentOS8跟换阿里源时使用yum makecache时下载巨慢,最后失败的解决办法
本来想装个CentOS 8虚拟机,费了半天劲才装好,装好之后想更换阿里源
准备照着下面的步骤做

博主连接:centos8更换国内源(阿里源)

#备份旧的配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
#并替换部分字段(非阿里云机器需要做)
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

vim CentOS-Base.repo 把$releasever改成8-stream
#生成缓存
yum makecache

但是当我执行到yum makecache时下载这个东西是巨慢->(8.7 kB/s)<-CentOS-8 - AppStream 6% [==- ] 8.7 kB/s……如下

[root@CentOS]# yum makecache
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream 6% [==-  ] 8.7 kB/s | 388 kB     10:37 ETCentOS-8 - AppStream                                                                  6.5 kB/s | 388 kB 00:59
# 最后慢的都失败了,试了好几次都不行
Error: Failed to download metadata for repo 'AppStream': Librepo was interrupted by a signal
# 下面还有些错误信息,被我弄丢了…………………………


解决办法
最后终于找到了解决办法,小白果然解决要半天,找到之后就明白了,是CentOS-AppStream.repo的镜像还没改:
博主连接:Centos8 安装软件 Failed to synchronize cache for repo ‘AppStream’, ignoring this repo.

直接修改这个文件

vim /etc/yum.repos.d/CentOS-AppStream.repo
# CentOS-AppStream.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.
#
#

[AppStream]
name=CentOS-$releasever - AppStream
# 加上这一条就行了
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/

gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#   把原来的这两条注释掉
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/

把$releasever改成8-stream

这个mirrorlist我找的解决办法里面也没提,我也不知道怎么改,索性注释掉,知道的可以分享一下
然后

yum clean all
yum makecache
速度嗖嗖嗖就起来了,爽哉,原来的慢的我都快崩溃了,原来的速度(8.7 kB/s),现在的(3.3 MB/s)。

[root@CentOS]# yum makecache
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                                                     3.3 MB/s | 5.8 MB     00:01    
CentOS-8 - Base - mirrors.aliyun.com                                     2.1 MB/s | 2.2 MB     00:01    
CentOS-8 - Extras - mirrors.aliyun.com                                    19 kB/s | 8.6 kB     00:00

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值