Centos 6无法使用yum解决办法

Centos 6无法使用yum解决办法

转载来自:https://blog.csdn.net/zhs260133172/article/details/111403417

具体错误出现的原因是:12月后Centos 6 系统无法使用yum

网上的教程都是很长时间之前的了,所以不管你怎么改都不会有用的,看之前的攻略纯属浪费时间 想解决类似问题,看这篇就够了

这两天在看Linux 在安装yum时,使用yum install lrzsz命令始终安装不上。自己查了一上午资料,看了三四十种方法。比如修改DNS、配置IP地址、重新写光驱、重装等方法全部都无效。就要放弃的时候看到了一个老哥说的方法:
在这里插入图片描述
报错信息如下:

[root@localhost ~]# yum makecache
Loaded plugins: fastestmirror
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

首先,问题出现的具体原因稍微说一下:

  1. CentOS 6已经随着2020年11月的结束进入了EOL(Reaches End of Life),不过有一些老设备依然需要支持,CentOS官方也给这些还不想把CentOS6扔进垃圾堆的用户保留了最后一个版本的镜像,只是这个镜像不会再有更新了
  2. 官方便在12月2日正式将CentOS 6相关的软件源移出了官方源,随之而来逐级镜像也会陆续将其删除。
  3. 不过有一些老设备依然需要维持在当前系统,CentOS官方也给这些还不想把CentOS6扔进垃圾堆的用户保留了各个版本软件源的镜像,只是这个软件源不会再有更新了。

换成大白话就是:Centos 6已经不被官方支持,所以想要使用就要用其他代理比如阿里云Vault镜像。

解决方法:
五条命令,执行完成即可,一定要打对!

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

注意 这里使用的是阿里云,也就是国内代理,如果服务器是海外,则把第三条命令替换为官方Vault源(海外服务器用)

curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Official.repo`

结果展示

[root@localhost yum.repos.d]# sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
102  1749  102  1749    0     0    362      0  0:00:04  0:00:04 --:--:--  8490
[root@localhost yum.repos.d]# yum clean all
Cleaning repos: base extras updates
Cleaning up Everything
[root@localhost yum.repos.d]# yum makecache
base                                    | 3.7 kB     00:00     
base/group_gz                           | 242 kB     00:00     
base/filelists_db                       | 6.4 MB     00:03     
base/primary_db                         | 4.7 MB     00:02     
base/other_db                           | 2.8 MB     00:01     
extras                                  | 3.4 kB     00:00     
extras/filelists_db                     |  24 kB     00:00     
extras/prestodelta                      | 2.2 kB     00:00     
extras/primary_db                       |  29 kB     00:00     
extras/other_db                         |  14 kB     00:00     
updates                                 | 3.4 kB     00:00     
updates/filelists_db                    | 8.4 MB     00:03     
updates/prestodelta                     | 357 kB     00:00     
updates/primary_db                      |  12 MB     00:06     
updates/other_db                        | 479 kB     00:00     
Metadata Cache Created

安装软件

[root@localhost yum.repos.d]# yum install wget lrzsz
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lrzsz.x86_64 0:0.12.20-27.1.el6 will be installed
---> Package wget.x86_64 0:1.12-10.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                  Arch                    Version                   Repository               Size
============================================================================================================
Installing:
 lrzsz                    x86_64                  0.12.20-27.1.el6          base                     71 k
 wget                     x86_64                  1.12-10.el6               base                     484 k

Transaction Summary
============================================================================================================
Install       2 Package(s)

Total download size: 555 k
Installed size: 1.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): lrzsz-0.12.20-27.1.el6.x86_64.rpm                  |  71 kB     00:00     
(2/2): wget-1.12-10.el6.x86_64.rpm                        | 484 kB     00:01     
------------------------------------------------------------------------------------------------------------
Total                           126 kB/s | 555 kB     00:04     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>"
 From  : http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lrzsz-0.12.20-27.1.el6.x86_64               1/2 
  Installing : wget-1.12-10.el6.x86_64                     2/2 
  Verifying  : wget-1.12-10.el6.x86_64                     1/2 
  Verifying  : lrzsz-0.12.20-27.1.el6.x86_64               2/2 

Installed:
  lrzsz.x86_64 0:0.12.20-27.1.el6                          wget.x86_64 0:1.12-10.el6                                                        
Complete!

这个真的挺管用的!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值