CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置

2023-05-16

错误如下:

[root@localhost svn]# yum install gcc-c++.x86_64
已加载插件:fastestmirror, langpacks
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 only
 safe 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 working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-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 much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

原因:没有配置resolv.conf
解决方法:
到/etc目录下配置resolv.conf加入nameserver IP,如:
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
保存再次运行上面的命令就可以。

/etc/resolv.conf 配置DNS 客户
文件/etc/resolv.conf 配置DNS 客户,它包含了主机的域名搜索顺序和DNS服务器的地址,每一行应包含一个关键字和一个或多个的由空格隔开的参数。
下面是一个例子文件:
**nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain**
合法的参数及其意义如下:
nameserver 表明DNS 服务器的IP 地址。可以有很多行的nameserver,每一个带一个I P 地址。在查询时就按nameserver 在本文件中的顺序进行,且只有当第一个nameserver 没有反应时才查询下面的nameserver.
domain 声明主机的域名。很多程序用到它,如邮件系统;当为没有域名的主
机进行DNS 查询时,也要用到。如果没有域名,主机名将被使用,删除所有在第一个点( . )前面的内容。
search 它的多个参数指明域名查询顺序。当要查询没有域名的主机,主机将在由search 声明的域中分别查找。domain 和search 不能共存;如果同时存在,后面出现的将会被使用。
sortlist 允许将得到域名结果进行特定的排序。它的参数为网络/掩码对。允许任意的排列顺序。Red Hat 中没有提供缺省的/ e t c / r e s o l v. c o n f 文件,它的内容是根据在安装时给出的选项动态创建的。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置 的相关文章

随机推荐

  • Ubuntu18.04下安装Cuda8及以上版本

    Ubuntu18 04下安装Cuda8及以上版本 cuda8已经不支持GCC5及以上版本的安装 xff0c 而ubuntu18自带的gcc版本为7 5 xff0c 所以安装时会报错Error unsupported compiler 7 5
  • ubuntu安装cmake的三种方法(超方便!)

    Ubuntu安装cmake的三种方法 xff08 超方便 xff01 xff09 第一种方法 xff08 不推荐 xff09 直接使用apt安装 xff0c 但是安装的版本很老 xff0c 不推荐这种方法 span class token
  • ubuntu中eigen库的安装(所有历史版本均可安装)

    ubuntu中eigen库的安装 所有历史版本均可安装 xff09 目前官网以及一些文章给出的wget网址出现错误 xff0c 下载不了 The requested repository either does not exist or y
  • Ubuntu安装opencv及问题解决(所有版本通用)

    Ubuntu安装opencv及问题解决 xff08 所有版本通用 xff09 安装编译 获取源码 span class token function git span clone https github com opencv opencv
  • 华为云端服务器使用ModelArts跑MindSpore框架Yolov5

    华为云端服务器使用Modlearts跑MindSpore框架Yolov5 环境准备 云平台登录 xff0c 用于购买服务器https uconsole xckpjs com 我这里用的是昇腾Ascend 910点击ModelArts打开控制
  • git 环境搭建以及常用指令笔记

    目录 1 Git 环境搭建1 1 Git 配置正常显示中文文件名 2 Git 常用指令2 1 Git 生成差异文件补丁包2 2 Git 移除未纳入跟踪的文件2 3 Git 选择性合并分支 1 Git 环境搭建 1 1 Git 配置正常显示中
  • ROS命令 catkin_init_workspace 分析

    ros版本 xff1a Ubuntu18 04 Melodic 之前在调试ros工作空间环境变量的问题的时候修改了工作空间src文件夹下的CMakeLists txt以进行打印消息分析出错的原因 在我新建另外一个工作空间 xff0c 执行c
  • BundleFusion复现手册——Win10+VS2013+Cuda8.0+KinectV2实时重建

    文章目录 一 摘要二 操作环境三 工程环境配置3 1 装VS2013和CUDA8 03 2 DirectX SDK 安装3 3 Kinect SDK 2 0 四 VS2013代码生成 xff08 以离线数据为例 xff09 4 1 依赖配置
  • C++基础入门

    C 43 43 基础入门 C 43 43 初识HelloWord变量 常量和关键字 数据类型整型实型 xff08 浮点型 xff09 字符串 C 43 43 初识 HelloWord 打开Visual Studio xff0c 创建新项目
  • 二(两)视图多视图点云配准

    二视图多视图点云配准综述 多视图视图点云配准多视图点云粗配准基于生成树的粗配准基于形状生成的多视图粗配准算法 多视图点云精配准 点云配准 xff08 Point Cloud Registration xff09 是将两个或多个点云数据集对齐
  • 点云传统滤波算法

    点云滤波 分割功能滤波直通滤波条件滤波提取索引滤波 下采样类滤波体素滤波均匀采样滤波 去除噪声点类滤波统计滤波半径滤波高斯滤波双边滤波随机采样一致滤波投影滤波 本文介绍了各种滤波算法的原理以及给出了相关实现方法 分割功能滤波 分割功能滤波是
  • K-d树和八叉树

    K d树 xff1a 解决KNN近邻问题查找效率 对于一个k维的超平面 xff0c 在KD树每一层的构建中都选择一个维度来进行划分 xff0c 将k维的数据空间分为两部分 xff0c 并使其尽量平衡 然后如此递归下去 也就是说假如我们要储存
  • C++突击面试

    目录 1 编译内存相关 1 1 C 43 43 程序编译过程 1 2 C 43 43 内存管理 1 3 栈和堆的区别 1 4 变量的区别 1 5 全局变量定义在头文件中有什么问题 xff1f 1 6 内存对齐 1 7 什么是内存泄露 1 8
  • 自动驾驶 规划综述

    Motion Planning What is motion planning 规划的本质是 xff1a 搜索问题 好 的规划就是一个目标函数 xff1a 求最优解 Motion Planning的三个领域 Robotic Fields 生
  • 数值最优化

    书 xff1a Numerical Optimization 文档 xff1a 安全验证 知乎 知乎 xff0c 中文互联网高质量的问答社区和创作者聚集的原创内容平台 xff0c 于 2011 年 1 月正式上线 xff0c 以 让人们更好
  • Qlist的用法

    QList是一种表示链表的模板类 QList是Qt的一种泛型容器类 它以链表方式存储一组值 xff0c 并能对这组数据进行快速索引 xff0c 还提供了快速插入和删除等操作 QList QLinkedList和QVector提供的操作极其相
  • QT QTableView 获取某行的所有信息

    1 信号槽 显示信息 connect ui gt tableView SIGNAL clicked QModelIndex this SLOT show list 2 获取当前行的行号 int row 61 ui gt tableView
  • ubuntu 开发环境配置记录

    目录 1 VIM及zsh配置记录2 Ubuntu 配置FTP服务器3 Ubuntu 配置SSH服务器4 Ubuntu 更换软件源 1 VIM及zsh配置记录 xvim tools rar 是别人已经搭建好的环境 xff0c 下文仅为对其配置
  • CMakeLists.txt 编辑语法学习

    已hello cpp为源文件 构建一个CMakeLists txt 1 2 3 cmake minimum required VERSION 2 8 project hello add executable hello hello cpp
  • CentOS yum有时出现“Could not retrieve mirrorlist ”的解决办法——resolv.conf的配置

    错误如下 xff1a root 64 localhost svn yum install gcc c 43 43 x86 64 已加载插件 xff1a fastestmirror langpacks Could span class hlj