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 try again

When trying to install the software through yum -y install XXX, the error of Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again appears.

Cause of the problem: The corresponding repomd.xml file cannot be found in the corresponding mirror library

Problem solving: There are no related files under the original centos/6/, try to modify the local mirror configuration file
Steps:

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

Because $releasever obtains the version number of centos, the version obtained by my centos is 6, but there is no corresponding version file in the mirror site, so the local configuration file needs to be modified

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

Or replace the referenced configuration


        http://mirrors.cloud.aliyuncs.com/centos/7/os/$basearch/
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/

exit save

:wq

Clear and regenerate cache

yum clean all 
yum makecache 

After completion, try to install the software again through yum -y install XXX

Guess you like

Origin blog.csdn.net/weixin_46220576/article/details/123230035