月度归档:2022年02月

Centos 6无法使用yum的解决方法_提示Error: Cannot find a valid baseurl for repo: base

https://www.liuzhanwu.cn/29909.html 原文链接

1、首先把fastestmirrors关了

#编辑
vi /etc/yum/pluginconf.d/fastestmirror.conf
#修改
enable=0

2、先把之前的repo挪到备份,然后下面两个二选一

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

3、替换为官方Vault源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Official.repo

或者国内用户可以替换为阿里云Vault镜像

wget -O /etc/yum.repos.d/CentOS-Base.repo https://static.lty.fun/%E5%85%B6%E4%BB%96%E8%B5%84%E6%BA%90/SourcesList/Centos-6-Vault-Aliyun.repo

4、如果没有wget的话,请使用SFTP或者直接nano、vi编辑/etc/yum.repos.d/CentOS-Base.repo!里面的东西替换成这两个选一个,国内用第二个阿里,国外建议第一个官方。

5、推荐使用懒人专用一键修复

sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
yum clean all
yum makecache

原因:

Announcement: CentOS 6 will reach End of Life (EOL) on November 30, 2020

不过有一些老设备依然需要支持,CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了最后一个版本的镜像,只是这个镜像不会再有更新了
官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。
不过有一些老设备依然需要维持在当前系统,CentOS官方也给这些还不想把CentOS 6扔进垃圾堆的用户保留了各个版本软件源的镜像,只是这个软件源不会再有更新了。
*****************异常信息*******************
[root@localhost yum.repos.d]# yum list installed
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/extras/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: extras
[root@localhost yum.repos.d]# yum list installed
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/extras/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: extras
参考文章
https://www.inmotionhosting.com/support/product-guides/vps-hosting/centos-6-end-of-life-eol/
https://wiki.centos.org/About/Product