首页 Linux网维 解决提示“Cannot retrieve metalink for repository: epel/x86_64” 的方法

解决提示“Cannot retrieve metalink for repository: epel/x86_64” 的方法

今天在centos7服务器上用yum的时候发现,yum命令不能用了,不管用yum什么命令都会出现如下提示: 1、错误提示一: One of the configured repos…

今天在centos7服务器上用yum的时候发现,yum命令不能用了,不管用yum什么命令都会出现如下提示:

1、错误提示一:

One of the configured repositories failed (Unknown),and yum doesn’t have enough cached data to continue.

中文翻译

其中一个已配置的存储库失败(未知),并且yum没有足够的缓存数据可以继续。

 

2、错误提示二:

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

中文翻译

无法检索存储库的metalink:epel / x86_64。 请验证其路径,然后重试

 

3、完整的错误提示如下:

One of the configured repositories failed (Unknown),
 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. Disable the repository, 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>

     4. 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 retrieve metalink for repository: epel/x86_64. Please verify its path and try again
解决提示“Cannot retrieve metalink for repository: epel/x86_64” 的方法插图

按照网上很多资料都没有解决我的问题,因为:

1、我的服务器 ping 正常的,无论是ping镜像还是ping其它网站都可以ping通。

2、/etc/resolv.conf 里面的 nameserver 114.114.114.114 也是有的,dns也没问题。

解决方法

想要解决问题,必须先要找原因,很多人碰上如上图这种错误的时候,都会首先认为是“错误提示一”这个问题,如果这样想,其实就大错特错了。

出现此问题,最根本的原因是“/etc/yum.repos.d/epel.repo”里面的镜像源路径不对。

既然找到了原因,解决起来就容易多了,具体步骤如下:

1、打开 /etc/yum.repos.d/epel.repo;

/etc/yum.repos.d/epel.repo

2、注释掉mirrorlist,取消注释baseurl;

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

修改为

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch

3、再次使用yum命令即正常!

yum clean all

yum makecache

yum update

yum install -y lsof

免责声明:文章内容不代表本站立场,本站不对其内容的真实性、完整性、准确性给予任何担保、暗示和承诺,仅供读者参考,文章版权归原作者所有。如本文内容影响到您的合法权益(内容、图片等),请及时联系本站,我们会及时删除处理。

作者: idcpu

dddddfdjskfjskdfjdksfjksdfjksjfdksjfdsfsdf

为您推荐

CentOS系统升级内核版本教程,centos内核版本升级

CentOS系统升级内核版本教程,centos内核版本升级

CentOS 系统升级系统内核版本  1、显示CentOS 系统内核版本:             [root@demo...
Linux下对 Nginx SSL 的性能进行调整

Linux下对 Nginx SSL 的性能进行调整

初始化服务器   这个web服务器运行在一个EC2 t1.micro 环境.我选择 Nginx + PHP5-FPM 来...
Linux Shell经典实例解析:Oracle启动脚本

Linux Shell经典实例解析:Oracle启动脚本

Oracle的启动脚本从功能上讲主要分为两个部分,第一部分是初始化各种环境变量,以确认当前Oracle服务器的版本,从而...
centOS6.4 64位下安装nfs文件共享系统

centOS6.4 64位下安装nfs文件共享系统

不知道谁装的服务器,默认自带,以下内容摘自互联网,配置部分按教程执行成功 一、环境介绍:   服务器:centos 19...
Linux下的Samba安装配置

Linux下的Samba安装配置

1 Samba 简介 Samba(SMB是其缩写) 是一个网络服务器,用于Linux和Windows共享文件之用;Sam...

发表回复

返回顶部