当前位置: 首页 > news >正文

CentOS 6 修改 yun 源

在 CentOS 6 中使用 yum 命令安装时可能会出现以下错误信息:

[root@localhost ~]# yum -y install wget
已加载插件:fastestmirror
设置安装进程
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
错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

出现的原因:CentOS 6 在 2020-11-30 已经结束使用。我们需要修改 yum 源信息,下面是修改 yun 源的方法:

依次输入:

# 进入 yum.repos.d 目录
cd /etc/yum.repos.d/
# 备份 CentOS-Base.repo 文件
cp CentOS-Base.repo CentOS-Base.repo.old
# 编辑 CentOS-Base.repo 文件
vi CentOS-Base.repo

将 CentOS-Base.repo 文件替换成以下内容:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

保存 CentOS-Base.repo 文件后依次输入:

# 清理 yun 缓存
yum clean all
# 更新 yun,该过程会比较慢,慢慢等待
yum update

之后使用 yun 命令就不会出问题了

在这里插入图片描述

CentOS-Base.repo 文件内容来自阿里


http://www.mrgr.cn/news/57463.html

相关文章:

  • 了解 .NET 8 中的定时任务或后台服务:IHostedService 和 BackgroundService
  • 【CBVFastAPI库】基于类的视图(Class-Based Views,简称CBV)的FastAPI的python库
  • 基于STM32的粮库检测系统设计
  • Python | Leetcode Python题解之第498题对角线遍历
  • python将1格式化为01
  • 关于QT cmake项目添加了.ui文件build未自动生成ui_xxx.h,错误提示找不到这个头文件问题处理
  • 【Linux】 su 和 sudo 的区别剖析
  • C#,自动驾驶技术,ASAM OpenDRIVE BS 1.8.0 规范摘要与C# .NET Parser
  • 农业自动气象监测站的工作原理
  • 深入解析MySQL数据库:从基础到进阶的全面剖析
  • 哥德巴赫猜想渐行渐远
  • 《1024:致敬程序员的数字乐章》
  • Mitre ATTCK攻击技术-权限维持-定时任务
  • Flutter鸿蒙next 刷新机制的高级使用【衍生详解】
  • 【.Net】【C#】Program.cs通用代码模板
  • 企业办公文件加密软件推荐!10款企业常用文件加密软件排行榜!
  • Clickhouse 笔记(一) 单机版安装并将clickhouse-server定义成服务
  • angular-electron调用java
  • 企业团队经典的激励理论:期望理论、赫茨伯格双因素理论、马斯洛需求层次理论、X理论和Y理论
  • 分布式系统中的Session管理:实现跨服务器的用户会话共享
  • 【数据结构】顺序表和链表
  • 【1024程序员节】之C++系列完结篇:Web编程
  • Java8项目如何升级到Java21?有啥坑?
  • 今日早报 每日精选15条新闻简报 每天一分钟 知晓天下事 10月24日,星期四
  • 代码随想录算法训练营第53天|107. 寻找存在的路径(并查集)
  • 【MyBatis面试题】