当前位置:首页 > 手机电脑 > linux教程 > Linux yum出错 Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please ver

Linux yum出错 Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please ver

2017-10-12 09:03:56[linux教程]点击数:作者:未知 来源: 网络
随机为您推荐的文章:linux打开文件时提示Write error in swap file

问题: 在linux环境下,用vi打开某文件时,提示Write error in swap file 原因:磁盘空间已满 解决:用df -hl命令查看磁盘使用情况,删除该区块中无用的文件     以上就是linux打开文件

本文将为您描述Linux yum出错 Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again,教程操作方法:

Linux下使用yum命令时报错Error: Cannot retrieve repository metadata (repomd.xml) for repository......,具体如下所示

[root@localhost yum.repos.d]# yum makecacheLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Repository base is listed more than once in the configurationfile:///media/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/repodata/repomd.xmlTrying 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 3633166dr-x------. 1 root root8.0kSep 14 20:32 CDROMdr-xr-xr-x. 12 root root8.0kJan 30 2013 RHEL_6.4 x86_64 Disc 1-rwxr-xr-x. 1 root root 3.5G Dec 16 2015rhel-server-6.4-x86_64-dvd.iso

请注意观察错误信息,在Error上有提示:

file:///media/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/repodata/repomd.xml

意思是说repomd文件没有找到,这会导致yum命令无法检索存储库元数据(翻译的,或者理解为找不到库);即需要让yum命令能找到这个文件,这个文件默认在系统安装光盘的/repodata/目录下;

检查yum配置信息,到/etc/yum.repos.d/下检查配置的repo文件:

[root@localhost /]# cd /etc/yum.repos.d/[root@localhost yum.repos.d]# ls -ltotal 8drwxr-xr-x. 2 root root 4096 Oct 11 02:04 bak_repo-rwxr-xr-x. 1 root root 162 Oct 11 01:36 rhel-base.repo[root@localhost yum.repos.d]# more rhel-base.repo [base]name=RedHatbaseurl=file:///media/enabled=1gpgcheck=0gpgkey=file:///media/RPM-GPG-KEY-redhat-release

这里关系到如何配置本地yum源,对于如何配置yum源,可以参考:

http://www.cnblogs.com/Wherebolezi/p/4626670.html

在本地yum配置文件上,可以看到yum指向本地的/media/文件;/media目录如下

[root@localhost yum.repos.d]# ls /media -hltotal 3.5Gdr-x------. 1 root root 2.0K Sep 14 20:32 CDROMdr-xr-xr-x. 12 root root 8.0K Jan 30 2013 RHEL_6.4 x86_64 Disc 1-rwxr-xr-x. 1 root root 3.5G Dec 16 2015 rhel-server-6.4-x86_64-dvd.iso

通过以上信息,表示/media目录下不存在repomd.xml文件,这个文件在RHEL_6.4 x86_64 Disc 1中;可以通过修改yum配置让系统能找到文件

修改后的内容如下(注意目录中的空格前需要\转义符):

[base]name=RedHatbaseurl=file:///media/RHEL_6.4\ x86_64\ Disc\ 1enabled=1gpgcheck=0gpgkey=file:///media/RHEL_6.4\ x86_64\ Disc\ 1/RPM-GPG-KEY-redhat-release

然后清理: yum clean all

yum makecache

结果如下所示:

[root@localhost yum.repos.d]# yum clean allLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Cleaning repos: baseCleaning up Everything[root@localhost yum.repos.d]# [root@localhost yum.repos.d]# [root@localhost yum.repos.d]# yum makecacheLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.base | 3.9 kB 00:00 ... base/group_gz | 204 kB 00:00 ... base/filelists_db | 3.7 MB 00:00 ... base/primary_db | 3.1 MB 00:00 ... base/other_db | 1.5 MB 00:00 ... Metadata Cache Created

没有Error: Cannot retrieve.....内容,且没有Could not open/read file......等打不开文件的提示,即表示问题已解决

如果问题仍然存在,则需要核对下安装光盘与系统本身是否匹配,或者yum源与系统版本的匹配程度,然后多执行几次yum clean all --> yum makecache观察情况

通过《Linux yum出错 Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again》的介绍希望对您了解和学习linux能够提供帮助.

这些内容可能对你也有帮助

更多linux教程可查看linux教程列表页。