错误:
[root@localhost ~]# yum install redis
Failed to set locale, defaulting to C.UTF-8
CentOS-mycompany - Base 1.2 kB/s | 236 B 00:00
Errors during downloading metadata for repository 'base':
- Status code: 404 for http://rdmirrors.h3c.com/centos/8/os/x86_64/repodata/repomd.xml (IP: 10.153.3.130)
Error: Failed to download metadata for repo 'base': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
分析:
HTTP 404 就是找不到网页。
将下面的yum使用的搜索路径,逐层的输入浏览器分析是哪一层开始找不到:http://rdmirrors.h3c.com/centos/8/os/x86_64/repodata/repomd.xml
最终发现http://rdmirrors.h3c.com/centos/8/ 下没有os,原来从8 开始,目录结构改变了。
CentOS-Base.repo里面 的Base
baseurl=http://rdmirrors.h3c.com/centos/$releasever/os/$basearch/
也就是
baseurl=http://rdmirrors.h3c.com/centos/8/os/x86_64/ 明显路径不对。所以需要修改
# CentOS-Base.repo
[base]
name=CentOS-mycompany - Base
baseurl=http://rdmirrors.h3c.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://rdmirrors.h3c.com/centos/RPM-GPG-KEY-CentOS-$releasever#released updates
[updates]
name=CentOS-mycompany - Updates
baseurl=http://rdmirrors.h3c.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://rdmirrors.h3c.com/centos/RPM-GPG-KEY-CentOS-$releasever#additional packages that may be useful
[extras]
name=CentOS-mycompany - Extras
baseurl=http://rdmirrors.h3c.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://rdmirrors.h3c.com/centos/RPM-GPG-KEY-CentOS-$releasever#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-mycompany - Plus
baseurl=http://rdmirrors.h3c.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://rdmirrors.h3c.com/centos/RPM-GPG-KEY-CentOS-$releasever
其他报404错误的,如[updates]、[extras]、[centosplus]也应该这样分析。
[extras]
baseurl=http://rdmirrors.h3c.com/centos/$releasever/extras/$basearch
根据
改为
baseurl=http://rdmirrors.h3c.com/centos/$releasever/extras/$basearch/os
[centosplus]
baseurl=http://rdmirrors.h3c.com/centos/$releasever/centosplus/$basearch/
根据
改为:
[centosplus]
baseurl=http://rdmirrors.h3c.com/centos/$releasever/centosplus/$basearch/os