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

Could not retrieve mirrorlist http://mirrorlist.centos.org错误解决方法

文章目录

  • 背景
  • 解决方法

在这里插入图片描述

背景

今天在一台新服务器上安装nginx,在这个过程中需要安装相关依赖,在使用yum install命令时,发生了以下报错内容:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"One of the configured repositories failed (未知),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: base/7/x86_64

通过查看这个报错日志,关键在第一句:Could not retrieve mirrorlist http://mirrorlist.centos.org,无法访问该链接。

具体原因:mirrorlist.centos.org 不再被支持。

解决方法

使用sed命令批量替换CentOS镜像源。具体如下:

sudo sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sudo sed -i s/^#.*baseurl=http/baseurl=https/g /etc/yum.repos.d/*.repo
sudo sed -i s/^mirrorlist=http/#mirrorlist=https/g /etc/yum.repos.d/*.repo

搞定。

http://www.lryc.cn/news/469345.html

相关文章:

  • 最新PHP网盘搜索引擎系统源码 附教程
  • SpringBoot面试热题
  • ASP.NET Core8.0学习笔记(二十三)——EF Core自引用
  • springboot童装销售管理系统-计算机毕业设计源码92685
  • OpenCV中的图像通道合并
  • Flutter TextField和Button组件开发登录页面案例
  • 【vue + mockjs】Mockjs——数据接口模拟
  • ssm订餐系统-计算机毕业设计源码26763
  • 4.2-7 运行MR应用:词频统计
  • 查看Chrome安装路
  • 深入剖析Canvas的getBoundingClientRect:精准定位与交互事件实现
  • SQL SERVER 2005/2008/2012/2016/2020 数据库状态为“可疑”的解决方法(亲测可用)
  • Linux: network: wireshark IO图的一个问题
  • TMGM平台可靠么?交易是否安全?
  • 软工毕设开题建议
  • Python自动化发票处理:使用Pytesseract和Pandas从图像中提取信息并保存到Excel
  • 新手直播方案
  • 【大模型理论篇】主流大模型的分词器选择及讨论(BPE/BBPE/WordPiece/Unigram)
  • 入侵检测算法平台部署LiteAIServer视频智能分析平台行人入侵检测算法
  • 000010 - Mapreduce框架原理
  • OpenCV未定义标识符CV_XXX
  • flask服务通过gunicorn启动
  • 用更多的钱买电脑而不是手机
  • 10.25学习
  • 用xshell给服务器上传jar包
  • 从零搭建开源陪诊系统:关键技术栈与架构设计
  • java List<Map<String, Object>> 转 List<JSONObject> 的几种方式
  • 使用Python来下一场深夜雪
  • uniapp使用easyinput文本框显示输入的字数和限制的字数
  • 蓝牙技术的多种模式详解