当使用带有Centos6映像的VirtualBox时,我不能再做yum更新了,我已经在互联网上检查过了,看起来Centos6已被弃用。
[root@centos69 ~]# yum makecache
Failed to set locale, defaulting to C
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/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
[root@centos69 ~]# yum update
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Loading mirror speeds from cached hostfile
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/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
解决这个问题有两种可能的方法:
- 编辑CentOS-Base。repo文件与vim
vim /etc/yum.repos.d/CentOS-Base.repo
删除或注释所有以'mirrorlist'开头的行。
并将以下行添加到文件的每个[节]中,如[base], [updates]…
baseurl=https://vault.centos.org/6.10/os/$basearch/
- 另一个解决方案是在来自此repo https://vault.centos.org/ 的映像上运行此命令
/scripts/autorepair centos6_base_repo_is_no_more
关于这些解决方案的更多信息:
https://support.cpanel.net/hc/en-us/articles/360058490254--CentOS-6-End-of-Life-Notice
https://forums.cpanel.net/threads/yumrepo-error-and-cannot-find-valid-baseurl.682465/
是的,就像红帽子6。x centos 6确实在2020年11月上线了,希望你的虚拟机里没有任何敏感的东西。https://forums.centos.org/viewtopic.php?t=72710
您可以在vault.centos.org更改为使用保险库。首先,您应该禁用任何不再工作的repo。您可以使用
获取repos列表yum repolist
则可以使用
禁用它们yum-config-manager --disable {reponame} {reponame}
yum-config-manager --disable base update
或者全部禁用
yum-config-manager |grep ^\[|tr -d ']['|xargs yum-config-manager --disable
一旦坏的repo被禁用,你需要添加vault repo。
yum-config-manager --add-repo=https://vault.centos.org/6.10/os/x86_64/
之后,你可以根据需要安装软件包,但请记住-它没有任何更新,所以如果安全问题,你需要将操作系统更改为支持的更新版本。
遵循这个帖子,它工作。https://www.getpagespeed.com/server-setup/how-to-fix-yum-after-centos-6-went-eol文章中的替代方法:
vi /etc/yum.repos.d/CentOS-Base.repo
并将内容替换为:
[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://vault.epel.cloud/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.epel.cloud/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.epel.cloud/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.epel.cloud/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
[C6.10-centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.epel.cloud/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never