Centos7系统安装yum遇到的问题failure: repodata/repomd.xml from base: [Errno 14] 网络不可达。

Posted 小志的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7系统安装yum遇到的问题failure: repodata/repomd.xml from base: [Errno 14] 网络不可达。相关的知识,希望对你有一定的参考价值。

参考此博文整理(亲测成功):https://blog.csdn.net/weixin_43965195/article/details/108372626

1、Centos7上通过yum安装nginx,配置好nginx的源后,执行yum list|grep nginx报错,看了很多博客说是执行下面三个语句就能解决,但是我的还是不行!

[root@localhost ~]# yum clean all   
[root@localhost ~]# yum clean metadata  
[root@localhost ~]# yum update

2、lz在虚拟机中安装的centos7环境,可以ping通www.baidu.com,说明网络没有问题。但是在虚拟机图形桌面上使用浏览器访问百度网站正常,访问nigix网站访问不到。

在这里插入图片描述
3、如果无法ping通,参考lz此博客链接

4、如果可以ping通,并且已经看了很多博客,修改了很多次yum的配置文件/etc/yum.repos.d/CentOS-Base.repo后还是不行,不妨试试lz的方法那就是删掉yum,重新安装

  • 将现有的yum源卸载

    #查看本机yum
    [root@localhost ~]# rpm -qa yum 
    yum-3.4.3-161.el7.centos.noarch
    #卸载yum相关的组件文件
    [root@localhost ~]# rpm -qa | grep yum | xargs rpm -e --nodeps		
    #再次查看本机yum,已经删除成功		
    [root@localhost ~]# rpm -qa yum					
    [root@localhost ~]#													
    

    在这里插入图片描述

  • 下载和yum有关的rpm包,如果对yum版本有特殊需求,可以到http://mirrors.163.com/centos/7/os/x86_64/Packages/查看。

     wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm 
     wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
     wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm  
    

    在这里插入图片描述在这里插入图片描述
    在这里插入图片描述

  • 安装yum,先安装yum-metadata-parser,再一起安装yum-3.4.3和yum-plugin-fastestmirror,因为它俩是依赖关系。

     rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
     rpm -ivh yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
    

    在这里插入图片描述

  • 重启虚拟机Centos7服务器,重启后再使用yum list|grep nginx命令,lz执行成功

    [root@localhost /]# reboot
    
    [root@localhost /]# yum list|grep nginx
    

    在这里插入图片描述

  • 以上步骤lz亲测成功,仅供各位小伙伴参考

以上是关于Centos7系统安装yum遇到的问题failure: repodata/repomd.xml from base: [Errno 14] 网络不可达。的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7.0使用yum安装MySQL及使用遇到的问题

CentOS7 yum的一次报错" 14: curl#56 - "Recv failure: Connection reset by peer" "

CentOS7 yum的一次报错" 14: curl#56 - "Recv failure: Connection reset by peer" "

centos7配置国内yum源

为centos7配置阿里yum源遇到的问题以及解决方法

centos7编译安装php 遇到的问题