Linux yum Error: Cannot retrieve repository metadata (repomd. xml) for repository: base. Please verify its path and try again,
In Linux, if you use the yum command, an Error occurs: Cannot retrieve repository metadata (repomd. xml) for repository ........ as follows:
[Root @ localhost yum. repos. d] # yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subrole-manager
This system is not registered to Red Hat sub‑management. You can use sub‑manager to register.
Repository base is listed more than once in the configuration
File: // media/repodata/repomd. xml: [Errno 14] cocould not open/read file: // media/repodata/repomd. xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd. xml) for repository: base. Please verify its path and try again
[Root @ localhost yum. repos. d] # ls/media-hl
Total 3633166
Dr-x ------. 1 root 8.0 k Sep 14 20:32CDROM
Dr-xr-x. 12 root 8.0 k Jan 30 2013RHEL_6.4 x86_64 Disc 1
-Rwxr-xr-x. 1 root 3.5G Dec 16 2015Rhel-server-6.4-x86_64-dvd.iso
Please observe the Error message with the prompt:
File: // media/repodata/repomd. xml: [Errno 14] cocould not open/read file: // media/repodata/repomd. xml
This means that the repomd file is not found, which causes the yum command to fail to retrieve the repository metadata (translated or understood as unable to find the repository); that is, the yum command must be able to find the file, by default, this file is stored in the/repodata/directory of the system installation disc;
Check the yum configuration information and go to/etc/yum. repos. d/to check the configuration repo file:
[Root @ localhost/] # cd/etc/yum. repos. d/
[Root @ localhost yum. repos. d] # ls-l
Total 8
Drwxr-xr-x. 2 root 4096 Oct 11Bak_repo
-Rwxr-xr-x. 1 root 162 Oct 11 0:36Rhel-base.repo
[Root @ localhost yum. repos. d] # rhel-base.repo more
[Base]
Name = RedHat
Baseurl = file: // media/
Enabled = 1
Gpgcheck = 0
Gpgkey = file: // media/RPM-GPG-KEY-redhat-release
This article describes how to configure the local yum source. For how to configure the yum source, refer:
Http://www.cnblogs.com/Wherebolezi/p/4626670.html
On the local yum configuration file, you can see that yum points to the local/media/file. The/media Directory is as follows:
[Root @ localhost yum. repos. d] # ls/media-hl
Total 3.5 GB
Dr-x ------. 1 root 2.0 K Sep 14 20:32CDROM
Dr-xr-x. 12 root 8.0 K Jan 30 2013RHEL_6.4 x86_64 Disc 1
-Rwxr-xr-x. 1 root 3.5G Dec 16 2015Rhel-server-6.4-x86_64-dvd.iso
The above information indicates that the repomd. xml file does not exist in the/media directory. This file is in RHEL_6.4 x86_64 Disc 1. You can modify the yum configuration so that the system can find the file.
The modified content is as follows (note that \ escape characters are required before spaces in the directory ):
[Base]
Name = RedHat
Baseurl = file: // media/RHEL_6.4 \ x86_64 \ Disc \ 1
Enabled = 1
Gpgcheck = 0
Gpgkey = file: // media/RHEL_6.4 \ x86_64 \ Disc \ 1/RPM-GPG-KEY-redhat-release
Then clear: yum clean all
Yum makecache
The result is as follows:
[Root @ localhost yum. repos. d] # yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subrole-manager
This system is not registered to Red Hat sub‑management. You can use sub‑manager to register.
Cleaning repos: base
Cleaning up Everything
[Root @ localhost yum. repos. d] #
[Root @ localhost yum. repos. d] #
[Root @ localhost yum. repos. d] # yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subrole-manager
This system is not registered to Red Hat sub‑management. You can use sub‑manager to register.
Base | 3.9 kB...
Base/group_gz | 204 kB...
Base/filelists_db | 3.7 MB...
Base/primary_db | 3.1 MB...
Base/other_db | 1.5 MB...
Metadata Cache Created
No Error: Cannot retrieve... content, and no prompts such as cocould not open/read file..., indicating that the problem has been resolved
If the problem persists, check whether the installation disc matches the system, or whether the yum source matches the system version, then run yum clean all --> yum makecache several times to observe the situation.