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

Centos7 使用 yum 报错 Could not retrieve mirrorlist

使用yum的时候报这个错误

在这里插入图片描述

解决方法

进文件夹 备份文件 改文件
cd /etc/yum.repos.d
cp CentOS-Base.repo CentOS-Base.repo.backup
vi 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-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#$baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
#baseurl=http://vault.centos.org/7.9.2009/x86_64/os/
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
彻底清理系统中的缓存和临时文件
sudo yum clean all
命令用于创建 yum 缓存,之后等待加载:
sudo yum makecache

在这里插入图片描述

更改为阿里云镜像源执行如下命令
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
彻底清理系统中的缓存和临时文件
sudo yum clean all
命令用于创建 yum 缓存
sudo yum makecache

http://www.kler.cn/a/553648.html

相关文章:

  • 【Rust中级教程】1.10. 引用及内部可变性(简单回顾):引用、内部可变性、`Cell`类型及相关操作
  • less 和 sass 的异同(css 预处理语言)
  • 非docker安装open-webui连接ollama实现deepseek本地使用,集成其他openai模型,常见启动报错问题解决。
  • 人工智能丨卷积神经网络的概念, 它与普通的神经网络有何不同
  • HarmonyOS的核心特性:分布式技术引领创新
  • DeepSeek与ChatGPT:会取代搜索引擎和人工客服的人工智能革命
  • Zookeeper(54)如何使用Zookeeper的命令行工具?
  • Redis-03高级篇下-最佳实践:
  • Nginx下proxy_redirect的三种配置方式
  • scroll、offset、client三大家族和getBoundingClientRect方法
  • android 定制mtp连接外设的设备名称
  • 基于JavaSpringboot+Vue实现前后端分离房屋租赁系统
  • lua的local 变量和self 变量的理解理解后解决自己写的bug.
  • 【论文阅读】DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
  • git-提交时间和作者时间的区别
  • 当使用vcpkg安装的qt5时,在VS调用出现libcrypto-*-x64.dll不是有效路径时
  • Docker如何切换文件目录安装——详细攻略!
  • IOS UITextField 无法隐藏键盘问题
  • 苹果新品今日发布,AI手机市场竞争加剧,近屿智能专注AI人才培养
  • 《深度学习》——ResNet网络