Centos 6 cannot use yum solution

888u

Last update at :2024-04-02,Edit by888u

Recently, some netizens reported that the yum command on Centos 6 cannot be used. The error message encountered is as follows:

[root@c8-20 ~]# yum -y install wget
Loaded plugins: fastestmirror
Setting up Install 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 6 has entered EOL (Reaches End of Life) with the end of November 2020. However, some old devices still need support. CentOS officials also reserve it for those users who do not want to throw CentOS 6 into the trash. The last version of the image has been installed, but this image will no longer be updated. To put it simply, the official has abandoned this image.

I chose two Vault sources to replace. One is the official http://vault.centos.org, which uses the North American AWS server. If you are overseas, you can use this one; the other is Alibaba's http:/ /mirrors.aliyun.com/centos-vault/, mainland China will not be stuck when using this.

1. First turn off fastestmirrors

#Edit
vi /etc/yum/pluginconf.d/fastestmirror.conf
#Revise
enable=0

2. First move the previous repo to backup, and then choose one of the following two

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

3. Replace with the official Vault source

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

Or users in mainland China can replace it with the Alibaba Cloud Vault image.

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. If there is no wget, please use SFTP or edit /etc/yum.repos.d/CentOS-Base.repo directly with nano or vi! Replace the content inside with one of these two. Mainland China uses the second Ali, and foreign countries recommend the first official one.

5. It is recommended to use one-click repair for lazy people

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

Recommended site searches: proxy server ip, server rental, free mainland China space, filing information query, icp filing query system, foreign server vps, domain name query official website, .net space, pw domain name, independent ip virtual host,

p>

Centos 6 cannot use yum solution

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码