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

虚拟机器centos7无法识别yum 命令异常处理笔记

问题现象

启动虚拟机后执行ipconfig 提示未找到该命令,然后执行yum install -y net-tools提示

curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"的错误

[root@haqdoop~]# ifconfig
-bash: ifconfig: 未找到命令
[root@hadoop~]# yum install -y net-tools 
已加载插件:fastestmirror
Determining fastest mirrors
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

问题排查

检查是否联网

查看是是否联网 ping 百度的域名无法识别

ping: www.baidu.com: 未知的名称或服务

执行 ping 114.114.114.114

正常ping 通,说明可以正常联网

排查是否yum源问题

网络搜索可能是yum源来的问题,执行

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo  

提示 curl: (6) Could not resolve host: mirrors.aliyun.com; 未知的错误 

最后的解决方式

vim /etc/resolv.conf

添加后执行yum 命令正常

# vi /etc/resolv.conf# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/resolv.conf设置linux本地的客户端DNS的配置文件。DNS可以实现域名和IP的互相解析,而我本地安装虚拟后该文件为空。

相关文章:

  • 普中51单片机学习(七)
  • Autosar-Mcal配置详解-GPT
  • java 课程签到管理系统Myeclipse开发mysql数据库web结构jsp编程servlet计算机网页项目
  • IP协议及相关技术协议
  • Git基本指令
  • 如何将OpenAI Sora生成的普通AI视频转化为Vision Pro的空间视频,沉浸式体验
  • Java入门-可重入锁
  • fish终端下conda activate失败
  • Web应用程序的自动测试工具WebDriver简介
  • vulfocus靶场搭建
  • 1 Nacos数据持久化方式
  • Linux:docker搭建redis集群(3主3从扩容缩容 哈希槽分配)
  • leetcode hot100单词拆分
  • 机器人内部传感器阅读笔记及心得-位置传感器-电位器式位置传感器
  • 目标检测一般性问题
  • conda常用的命令
  • Java面向对象及其三大特征
  • Linux下的乱码问题
  • mysql innodb 索引使用指南
  • node和express搭建代理服务器(源码)
  • Object.assign方法不能实现深复制
  • PHP面试之三:MySQL数据库
  • Transformer-XL: Unleashing the Potential of Attention Models
  • Vue实战(四)登录/注册页的实现
  • webpack项目中使用grunt监听文件变动自动打包编译
  • 创建一个Struts2项目maven 方式
  • 每天10道Java面试题,跟我走,offer有!
  • 微信小程序上拉加载:onReachBottom详解+设置触发距离
  • 吴恩达Deep Learning课程练习题参考答案——R语言版
  • 在GitHub多个账号上使用不同的SSH的配置方法
  • ​ubuntu下安装kvm虚拟机
  • ​Z时代时尚SUV新宠:起亚赛图斯值不值得年轻人买?
  • ###51单片机学习(2)-----如何通过C语言运用延时函数设计LED流水灯
  • #Z2294. 打印树的直径
  • (aiohttp-asyncio-FFmpeg-Docker-SRS)实现异步摄像头转码服务器
  • (AngularJS)Angular 控制器之间通信初探
  • (C)一些题4
  • (Redis使用系列) Springboot 实现Redis 同数据源动态切换db 八
  • (免费领源码)python#django#mysql校园校园宿舍管理系统84831-计算机毕业设计项目选题推荐
  • (区间dp) (经典例题) 石子合并
  • (十八)用JAVA编写MP3解码器——迷你播放器
  • (一)Linux+Windows下安装ffmpeg
  • (原創) 如何動態建立二維陣列(多維陣列)? (.NET) (C#)
  • (原創) 如何將struct塞進vector? (C/C++) (STL)
  • (转) Face-Resources
  • (转)使用VMware vSphere标准交换机设置网络连接
  • ***检测工具之RKHunter AIDE
  • .naturalWidth 和naturalHeight属性,
  • .Net 6.0 处理跨域的方式
  • .net Signalr 使用笔记
  • .NET 设计一套高性能的弱事件机制
  • .NET6 命令行启动及发布单个Exe文件
  • .Net8 Blazor 尝鲜
  • .NET建议使用的大小写命名原则
  • .set 数据导入matlab,设置变量导入选项 - MATLAB setvaropts - MathWorks 中国