Centos8为 repo ‘AppStream‘ 下载元数据失败

Centos8 使用yum下载软件的时候报错如下

2022-02-02T11:39:36Z DEBUG error: Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org] (http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock).
2022-02-02T11:39:36Z WARNING Errors during downloading metadata for repository 'AppStream':
- Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=AppStream&infra=stock [Could not resolve host: mirrorlist.centos.org]
  1. /etc/yum.repos.d/目录下

    cd /etc/yum.repos.d/
    
  2. 修改三个文件的数据源为阿里云的,三个文件分别是CentOS-Linux-Base.repoCentOS-Linux-AppStream.repoCentOS-Linux-Extras.repo

    CentOS-Linux-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://mirrors.aliyun.com/centos/$releasever-stream/BaseOS/$basearch/os/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    

    CentOS-Linux-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://mirrors.aliyun.com/centos/$releasever-stream/AppStream/$basearch/os/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    

    CentOS-Linux-Extras.repo

    [extras]
    name=CentOS Linux $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://mirrors.aliyun.com/centos/$releasever-stream/extras/$basearch/os/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    
  3. 修改完之后,清楚一下缓存文件

    yum clean all
    
  4. 用新的数据源做缓存

    yum makecache
    

image-20220305194446900

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐