当前位置: 代码迷 >> 综合 >> [centerOS]错误:为仓库 ‘appstream‘ 下载元数据失败
  详细解决方案

[centerOS]错误:为仓库 ‘appstream‘ 下载元数据失败

热度:54   发布时间:2023-12-12 01:03:54.0

错误:为仓库 ‘appstream’ 下载元数据失败

problem

希望安装nginx: sudo yum install nginx

报错:

Errors during downloading metadata for repository 'appstream':- Status code: 404 for http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 100.100.2.148)
错误:为仓库 'appstream' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

solution

  1. 检查网通不通: 是通的
    [root@iZbp1560750pcozwmd20reZ yum.repos.d]# ping www.baidu.com
    PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.
    64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=50 time=13.4 ms
    64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=50 time=13.4 ms
    64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=50 time=13.4 ms

  2. 替换 CentOS-Base.repo 元
    cd /etc/yum.repos.d
    mv CentOS-Linux-BaseOS.repo CentOS-Linux-BaseOS.repo.backup #备份
    wget -O CentOS-LinuxBaseOS.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo #拉取新文件

  3. 修改配置
    vim /etc/yum.repos.d/CentOS-Linux-AppStream.repo
    替换 baseurl

#baseurl=http://mirrors.cloud.aliyuncs.com/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/8.5.2111/AppStream/$basearch/os/
  1. 创建元数据
    yum makecache
[root@iZbp1560750pcozwmd20reZ yum.repos.d]# yum makecache
Repository extras is listed more than once in the configuration
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Linux-epel.repo; 配置:ID 为 "failovermethod" 的 OptionBinding 不存在
CentOS-8.5.2111 - Base - mirrors.aliyun.com      63 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com    27 kB/s | 1.5 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.co  83 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - AppStream                       31 MB/s | 8.4 MB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64   42 MB/s |  11 MB     00:00    
元数据缓存已建立。