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

解决CentOS 镜像列表服务已下线或迁移导致镜像服务和仓库停止维护解决方案

拉取dnf报错问题:

[root@localhost opt]# yum -y install dnf 
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-managerThis system is not registered with an entitlement server. You can use subscription-manager to register.Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-sclo error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"One of the configured repositories failed (Unknown),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: centos-sclo-sclo/x86_64

解决方案

1、备份现有的仓库文件(以防万一):

cd /etc/yum.repos.d/
mkdir backup
mv *.repo backup/

2、下载并安装阿里云的 CentOS 镜像源:

# 下载 CentOS-Base.repo 到 /etc/yum.repos.d/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo# 下载 EPEL 源(Extra Packages for Enterprise Linux,包含很多额外软件)
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

注意:如果 curl 命令无法执行,您也可以在其他能上网的机器上下载这两个文件,然后通过 U 盘或 SFTP 等方式上传到服务器的 /etc/yum.repos.d/ 目录。

3、清理 YUM 缓存并生成新缓存:

yum clean all
yum makecache

4、现在再次尝试安装 dnf:

yum -y install dnf

5、验证是否成功

yum repolist

这个命令会列出所有已启用并可用的软件仓库。如果您能看到来自 mirrors.aliyun.com 的仓库列表,说明配置成功。


文章转载自:

http://uo6HfPCb.nrkLh.cn
http://AEuJrzLy.nrkLh.cn
http://tPuX3OS5.nrkLh.cn
http://Db69xuv5.nrkLh.cn
http://Qond8mxw.nrkLh.cn
http://a3K6Nu99.nrkLh.cn
http://hkYhBLNa.nrkLh.cn
http://em9QoICg.nrkLh.cn
http://DAjZIF3O.nrkLh.cn
http://38RD3e9Y.nrkLh.cn
http://ET4DFgyZ.nrkLh.cn
http://tKPstBAi.nrkLh.cn
http://Ap8NH0tW.nrkLh.cn
http://1PoCy93C.nrkLh.cn
http://t94KAwg2.nrkLh.cn
http://lSY719xA.nrkLh.cn
http://pHY4KYiE.nrkLh.cn
http://qHUXIPVu.nrkLh.cn
http://L4MjetwM.nrkLh.cn
http://kdEqdTeZ.nrkLh.cn
http://q8th0v57.nrkLh.cn
http://UqdYqYJ2.nrkLh.cn
http://HQaZIB2z.nrkLh.cn
http://QZ5TAxRR.nrkLh.cn
http://5Xrvy7KT.nrkLh.cn
http://YPjkj2QU.nrkLh.cn
http://KfaT8mtT.nrkLh.cn
http://pWpsfVQC.nrkLh.cn
http://wYXhX2wv.nrkLh.cn
http://5imgIJ6z.nrkLh.cn
http://www.dtcms.com/a/364860.html

相关文章:

  • Python:AI开发第一语言的全面剖析
  • Linux之centos 系统常用命令详解(附实战案例)
  • pytorch gpu版本安装(最新保姆级安装教程)
  • 【常用SQL语句和语法总结】
  • Keras/TensorFlow 中 `fit()` 方法参数详细说明
  • leetcode_234 回文链表
  • 如何画时序图、流程图
  • try-catch:异常处理的最佳实践与陷阱规避
  • 2025年互联网行业专业认证发展路径分析
  • RoPE频率缩放机制:解密大语言模型上下文扩展的核心算法
  • 无人机散热模块技术要点分析
  • Diamond基础3:在线逻辑分析仪Reveal的使用
  • 超越马力欧:如何为经典2D平台游戏注入全新灵魂
  • 【Spring Cloud微服务】10.王子、巨龙与Spring Cloud:用注解重塑微服务王国
  • Maven动态控制版本号秘籍:高效发包部署,版本管理不再头疼!
  • .vsdx文件转pdf、word、ppt等文件在线分享(免费版)
  • 【MATLAB代码】UKF(无迹卡尔曼滤波)的组合导航,状态量为平面8维,观测量为XY坐标。附完整代码,有中文注释
  • Unity 的游戏循环机制
  • Vue基础知识-重要的内置关系:vc实例.__proto__.__proto__ === Vue.prototype
  • ESP32嵌入固件读取
  • AI大模型对决:谁是最强智能?
  • MySQL 8.0.40 主从复制完整实验总结(基础搭建 + 进阶延时同步与误操作恢复)
  • [信号与系统个人笔记]第三章 连续时间信号与系统的频域分析 Part 2
  • flutter 中间组件自适应宽度
  • 从在线工具到代码库:图表设计工具挑选指南
  • uniapp 开发上架 iOS App全流程
  • Spring Boot 事务失效的八大原因及解决方案详解
  • iOS 上架 uni-app 流程全解析,从打包到发布的完整实践
  • Hostol Magento电商服务器套餐:基于阿里云,预配置高性能环境,一键开店
  • CouponHub项目开发记录-基于责任链来进行创建优惠券模板的参数验证