Centos8使用yum报错 Couldn‘t resolve host name for http://mirrorlist.centos.org/?releas

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

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值