CentOS8解决Failed to download metadata for repo appstream错误

修改补充,发现靠谱的方法还是修改为国内镜像源

首先备份原有的内容

cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/

因为centos8官方源已下线,所以不可以在获取

wget -O /etc/yum.repos.d/CentOS-aliyun.repo http://mirrors.aliyun.com/repo/Centos-8.repo

需要求改为centos-vault源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

最后清除系统yum缓存,并重新生成新的yum缓存

dnf -y install epel-release
dnf clean all
dnf makecache
dnf repolist

 

------------------------------------------------下文为原有内容------------------------------------------

原文来自(29条消息) CentOS8解决“Failed to download metadata for repo ‘appstream‘”错误_培根芝士的博客-CSDN博客https://blog.csdn.net/watson2017/article/details/122887710

 在原文内容上整理了一下 ,另外的CentOS8内的文件名和原文不一样

1:首先进入 /etc/yum.repos.d目录查看文件列表

cd /etc/yum.repos.d

需要修改以下四个文件,分别为:

CentOS-AppStream.repo

[appstream]
name=CentOS Linux $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

CentOS-Base.repo

[baseos]
name=CentOS Linux $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

CentOS-Extras.repo

[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/Extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

CentOS-PowerTools.repo

[PowerTools]
name=CentOS-$releasever - PowerTools
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

依葫芦画瓢的修改

1:注释mirrorlist 和baseurl

baseurl=https://vault.centos.org/centos/$releasever/AppStream/$basearch/os/

2:新增修改baseurl 根据文件中name 修改红色部分例如 BaseOS AppStream PowerTools Extras

最后建议执行以下yum clean all,清理一下缓存,否则可能不生效

  • 3
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值