完美解决CentOS8 yum安装AppStream报错,更新yum后无法makecache的问题

CentOS 8 yum安装软件时,提示无法从AppStream下载

[root@C8-3 ~]# yum -y install httpd mariadb-server mariadb php php-mysql
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
Repository fasttrack is listed more than once in the configuration
CentOS-8 - AppStream                           0.0  B/s |   0  B     00:08    
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

  

更换国内yum源

# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup.3
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo

 

清理之前的yum缓存

# yum clean all

  

建立新的缓存

# yum makecache

  

解决makecahe报错

centos8会出现以下报错

CentOS-8 - AppStream                           0.0  B/s |   0  B     00:04    
Failed to download metadata for repo 'AppStream'
Error: Failed to download metadata for repo 'AppStream'

  

解决办法

  • 将CentOS-AppStream.repo文件中的链接更新
# vim /etc/yum.repos.d/CentOS-AppStream.repo
  • 注释掉原有内容,并插入新内容
#这一段注释掉
#[AppStream]
#name=CentOS-$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/
#mirrorlist=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
#gpgcheck=1
#enabled=1
#pgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

#改为下面这段
[AppStream]
name=Qcloud centos AppStream - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
  • 重新运行 # yum makecache
# yum makecache 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值