Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and tr

  • Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and tr已关闭评论
  • 211 次浏览
  • A+
所属分类:linux技术
摘要

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站通过yum -y install XXX 尝试安装软件,出现Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again的错误

镜像下载、域名解析、时间同步请点击 阿里云开源镜像站

错误:Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

通过yum -y install XXX 尝试安装软件,出现Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again的错误

问题原因:对应的镜像库中无法找到对应的repomd.xml文件

问题解决:原centos/6/ 下已经没有相关的文件,尝试修改本地镜像配置文件

步骤:

cd /etc/yum.repos.d 
vim CentOS-Base.repo 

因为$releasever 获取的是centos的版本号,我的centos获取的版本为6,但是镜像站中无对应版本文件,因此需要修改本地配置文件

:%s/$releasever/7/g #将文件中$releasever全部改成7或其他版本 

或者替换参考的配置

gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7  #released updates  [updates] name=CentOS-7 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/updates/$basearch/         http://mirrors.aliyuncs.com/centos/7/updates/$basearch/         http://mirrors.cloud.aliyuncs.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7  #additional packages that may be useful [extras] name=CentOS-7 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/extras/$basearch/         http://mirrors.aliyuncs.com/centos/7/extras/$basearch/         http://mirrors.cloud.aliyuncs.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7  #additional packages that extend functionality of existing packages [centosplus] name=CentOS-7 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/centosplus/$basearch/         http://mirrors.aliyuncs.com/centos/7/centosplus/$basearch/         http://mirrors.cloud.aliyuncs.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7  #contrib - packages by Centos Users [contrib] name=CentOS-7 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=http://mirrors.aliyun.com/centos/7/contrib/$basearch/         http://mirrors.aliyuncs.com/centos/7/contrib/$basearch/         http://mirrors.cloud.aliyuncs.com/centos/7/contrib/$basearch/ 

退出保存

:wq 

清除和重新生成缓存

yum clean all  yum makecache  

完成之后再次通过yum -y install XXX 尝试安装软件

本文转自:https://blog.csdn.net/weixin_46220576/article/details/123230035