随笔 - 45,  文章 - 1,  评论 - 6,  阅读 - 23万

一、CentOS6 yum命令报错YumRepo Error: All mirror URLs are not using ftp, http[s] or file

1、网上有些人说是/etc/yum.repos.d/CentOS-Base.repo这个文件的配置问题,注释掉mirrorlist这个配置项就能成功,试下看看

 mirrorlist都注释掉了,还是报错,但是报错信息不是All mirror URLs are not using ftp, http[s] or file.了,而是404 not find

后来猜想,应该是配置中的链接访问不了,然后把baseurl这个配置的链接去浏览器访问,果然是404,原来是这个外国网站挂了。

2、修改yum源:尝试如下各种方法

方法1)、把源站点配置改为国内清华大学站点https://mirrors.tuna.tsinghua.edu.cn/centos-vault

             修改yum源站点配置:vi /etc/yum.repos.d/CentOS-Base.repo

             对照清华大学镜像站中的目录修改后如下:

           

          

          执行yum install openssh-clients,仍报错404 not found

方法2)、更新yum源为aliyun源

         步骤1、更新yum源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
               (Centos7为:wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
         步骤2、自动加载一下在线更新源:yum list  仍然报错

后来才知道:CentOS6已经在2020年11月30日停止维护了。centos官方停止了对centos6的所有更新,并且下架了包括官方所有的centos6源,目前阿里、163、清华等centos6源已无法使用。

 更新源还是404错误

二、修改yum源后404 Not Found解决方法:

备份配置文件,防止以后出错后不好恢复

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

执行下面命令,新建CentOS-Base.repo配置:

vim /etc/yum.repos.d/CentOS-Base.repo

复制粘贴如下命令

[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6

保存后退出

执行yum list  正常无报错

此时即可正常使用yum命令了。

 

 

 

 

          

 

posted on   开心萌小小  阅读(25416)  评论(2编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示