One of the configured repositories failed (Unknown), and yum doesn't have enough cached data t

 

1、问题

[root@localhost home]# yum install httpd
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.


 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

 

2、解决方法,去掉baseurl前面的注释,将metalink注释掉

[root@localhost home]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
epel.repo  epel-testing.repo  packagekit-media.repo  rhel7.repo
[root@localhost yum.repos.d]# vim epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
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
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
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
#metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

 

3、测试

[root@localhost yum.repos.d]# yum install httpd
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
epel                                                                                                          | 4.7 kB  00:00:00
rhel7                                                                                                         | 4.1 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                   |  95 kB  00:00:04
(2/3): epel/x86_64/updateinfo                                                                                 | 1.0 MB  00:00:13
(3/3): epel/x86_64/primary_db                                                                                 | 6.9 MB  00:01:24
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
 Package                           Arch                         Version                            Repository                   Size
=====================================================================================================================================
Installing:
 httpd                             x86_64                       2.4.6-17.el7                       rhel7                       1.2 M
Installing for dependencies:
 apr                               x86_64                       1.4.8-3.el7                        rhel7                       103 k
 apr-util                          x86_64                       1.5.2-6.el7                        rhel7                        92 k
 httpd-tools                       x86_64                       2.4.6-17.el7                       rhel7                        77 k

Transaction Summary
=====================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 1.4 M
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
-------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                174 MB/s | 1.4 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                                                            1/4
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                       2/4
  Installing : httpd-tools-2.4.6-17.el7.x86_64                                                                                   3/4
  Installing : httpd-2.4.6-17.el7.x86_64                                                                                         4/4
  Verifying  : httpd-tools-2.4.6-17.el7.x86_64                                                                                   1/4
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                                            2/4
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                       3/4
  Verifying  : httpd-2.4.6-17.el7.x86_64                                                                                         4/4

Installed:
  httpd.x86_64 0:2.4.6-17.el7

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7               apr-util.x86_64 0:1.5.2-6.el7               httpd-tools.x86_64 0:2.4.6-17.el7

Complete!

 

上一篇:linux 查看空间


下一篇:.gitignore文件不生效解决方法