完美解决CentOS8 yum安装AppStream报错

在CentOS8系统中,尝试通过yum安装httpd、mariadb、php和php-mysql等软件时遇到AppStream仓库下载失败的错误。首先检查网络连接和DNS解析正常,然后尝试更换为国内的yum源,如阿里云或腾讯云的CentOS8基础镜像源,并清理及更新yum缓存。然而,问题依然存在,AppStream仓库的下载 metadata 未能成功获取。
摘要由CSDN通过智能技术生成

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

[root@192 ~]# 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'

 1.  先排除网络问题检查网通不通,然后确定DNS解析是否正确。

[root@192 ~]# ping www.baidu.com
PING baidu.com (220.181.38.148) 56(84) bytes of data.
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=12.3 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=12.2 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=12.7 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=13.5 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=128 time=12.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=128 time=12.1 ms
64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=7 ttl=128 time=13.7 ms

2.更换国内的yum源

  • 阿里yum源: centos镜像-centos下载地址-centos安装教程-阿里巴巴开源镜像站
  • 腾云yum源: CentOS
  • [root@192 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup.3
    [root@192 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos8_base.repo

    3.清理之前的yum缓存。

  • [root@192 ~]# yum clean all
    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
    18 files removed

    4.建立新的缓存。

  • [root@192 ~]# 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
    Repository fasttrack is listed more than once in the configuration
    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'

评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值