急着洗澡睡觉,仓促一记
今天下午yum clean 然后update后,就无法下载缓存包了,运行yum makecache要么提示
http://mirrors.cloud.aliyuncs.com/centos/7-7.1908.0.el7.centos/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
要么提示
https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/7-7.1908.0.el7.centos/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Foun
这两个一个是阿里源,一个是清华源,ping 了一下域名,都可以ping通,点进去看
而我的版本是 7-7.1908.0.el7.centos
导致在源内找不到我的版本,于是我找到/etc/yum.repos.d/CentOS-Base.repo
查看源地址是怎么和版本拼接,发现是通过一个变量$releasever
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
...
所以关键就是修改这个变量为源里所有的版本号,我的版本是Centos 7
,所以直接改为7
即可
echo "7" > /etc/yum/vars/releasever