故障现象
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
[root@localhost ~]# yum makecache
CentOS-8 - Base - mirrors.aliyun.com 76 B/s | 2.3 kB 00:30 [Errors during downloading metadata for repository 'base': ] --- - Status code: 404 for https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml (IP: 119.96.71.242)
Curl error (28): Timeout was reached for http://mirrors.aliyuncs.com/centos/8/BaseOS/x86_64/os/repodata/repomd.xml [Connection timed out after 30004 milliseconds]
Curl error (6): Couldn't resolve host name for http://mirrors.cloud.aliyuncs.com/centos/8/BaseOS/x86_64/os/re
提示无法找到文件
处理过程
//查看系统版本
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.2 (Ootpa)
//查看路径 URL ,发现(centos 8 ~8.5 版本)的文件 已经迁移到 https://mirrors.aliyun.com/centos/8-stream/ 这个目录下
[root@localhost ~]# curl https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/repodata/repomd.xml
把 CentOS-Base.repo 文件里的$releasever 替换为 8-stream
[root@localhost ~]# sed -i 's/$releasever/8-stream/' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum clean all
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
37 files removed
[root@localhost ~]# yum makecache
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
CentOS-8.5.2111 - Base - mirrors.aliyun.com 1.9 MB/s | 21 MB 00:10
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 158 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 1.3 MB/s | 21 MB 00:16
Docker CE Stable - x86_64 5.3 kB/s | 23 kB 00:04
Metadata cache created.
##完成
注:centos 8 ~ centos8.5 版本的文件已迁移到https://mirrors.aliyun.com/centos/8-stream/