Java教程

sudo yum install -y yum-utils 时出错

本文主要是介绍sudo yum install -y yum-utils 时出错,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

sudo yum install -y yum-utils 时出错

    • centOS 安装yum-utils时出错

centOS 安装yum-utils时出错

出现下面错误:

[root@iZbp15upsrdbnx99j4uix7Z /]# sudo yum install -y yum-utils
CentOS-8 - AppStream                                                                                  19 kB/s | 2.3 kB     00:00    
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)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

上面说了是 http://mirrors.cloud.aliyuncs.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml 这个地址404

网上找了一圈,说要找到配置文件打开 /etc/yum.repos.d 目录下的 CentOS-Base.repo 修改 baseurl 为阿里云的地址 :

[BaseOS]
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

我跟着配置发现不行,仔细观察报错 发现是'AppStream' 这个文件,所以再次找到 /etc/yum.repos.d 目录,把这个目录下的 CentOS-AppStream.repobaseurl 也改为阿里云的地址

[AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

接着还是不行

[root@iZbp15upsrdbnx99j4uix7Z yum.repos.d]# sudo yum install -y yum-utils
CentOS-8 - AppStream                                                                                 8.3 kB/s | 2.3 kB     00:00    
Errors during downloading metadata for repository 'AppStream':
  - Status code: 404 for https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml (IP: 39.96.118.147)
Error: Failed to download metadata for repo 'AppStream': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

然后问题回到那个404 的地址,直接复制在浏览器是打不开的,但是https://mirrors.aliyun.com/centos是可以打开的

我顺着目录,发现 https://mirrors.aliyun.com/centos/8-stream/AppStream/这个目录,然后就对应上了那个404 的地址

所以我回到 CentOS-AppStream.repobaseurl 改为

baseurl=https://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/

重新执行sudo yum install -y yum-utils

ok 解决问题

这篇关于sudo yum install -y yum-utils 时出错的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!