yum install 安装时报yum doesn't have enough cached data to continue

yum install 安装时报yum doesn't have enough cached data to continue.

安装epelyum -y install epel-release后,yum安装时出现如下异常:

[root@ec-cache ~]# yum install gcc
已加载插件:fastestmirror
base                                                                                                                                                      | 3.6 kB  00:00:00

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:

 <span class="hljs-number">1.</span> Contact the upstream <span class="hljs-keyword">for</span> the repository <span class="hljs-keyword">and</span> <span class="hljs-keyword">get</span> them <span class="hljs-keyword">to</span> fix the problem.

 <span class="hljs-number">2.</span> Reconfigure the baseurl/etc. <span class="hljs-keyword">for</span> the repository, <span class="hljs-keyword">to</span> point <span class="hljs-keyword">to</span> a working
    upstream. This <span class="hljs-keyword">is</span> most often useful <span class="hljs-keyword">if</span> you are <span class="hljs-keyword">using</span> a newer
    distribution release than <span class="hljs-keyword">is</span> supported <span class="hljs-keyword">by</span> the repository (<span class="hljs-keyword">and</span> the
    packages <span class="hljs-keyword">for</span> the previous distribution release still work).

 <span class="hljs-number">3.</span> Disable the repository, so yum won<span class="hljs-comment">'t use it by default. Yum will then</span>
    just ignore the repository <span class="hljs-keyword">until</span> you permanently enable it again <span class="hljs-keyword">or</span> use
    --enablerepo <span class="hljs-keyword">for</span> temporary usage:

        yum-config-manager --disable &lt;repoid&gt;

 <span class="hljs-number">4.</span> Configure the failing repository <span class="hljs-keyword">to</span> be skipped, <span class="hljs-keyword">if</span> it <span class="hljs-keyword">is</span> unavailable.
    Note that yum will <span class="hljs-keyword">try</span> <span class="hljs-keyword">to</span> contact the repo. <span class="hljs-keyword">when</span> it runs most commands,
    so will have <span class="hljs-keyword">to</span> <span class="hljs-keyword">try</span> <span class="hljs-keyword">and</span> fail <span class="hljs-keyword">each</span> time (<span class="hljs-keyword">and</span> thus. yum will be be much
    slower). <span class="hljs-keyword">If</span> it <span class="hljs-keyword">is</span> a very temporary problem though, this <span class="hljs-keyword">is</span> often a nice
    compromise:

        yum-config-manager --save --setopt=&lt;repoid&gt;.skip_if_unavailable=<span class="hljs-literal">true</span>

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

解决办法:
1、将/etc/yum.repos.d/epel.repo中的mirrorlist改为baseurl

[root@ec-cache ~]# /usr/bin/vi /etc/yum.repos.d/epel.repo

[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
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

2、/etc/resolv.conf文件中增加nameserver 144.144.144.144

[root@ec-cache ~]# vi /etc/resolv.conf

# Generated by NetworkManager
nameserver 192.168.1.2
nameserver 144.144.144.144

3、再次执行即可

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值