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

yum安装软件报错

[root@localhost local]# yum -y install gcc
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

查找解决办法时说是repomd文件没有找到,这会导致yum命令无法检索存储库元数据(或者理解为找不到库);即需要让yum命令能找到这个文件,

解决办法:更换yum源
mv /etc/yum.repos.d/* /tmp/
备份源文件

cd /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
下载yum源文件

vim CentOS-Base.repo
修改文件中的源地址

改为vault.centos.org
在这里插入图片描述
改为https://vault.centos.org/6.5/os/x86_64/
在这里插入图片描述

sudo yum clean all && yum makecache
释放yum的缓存

yum -y install lrzsz yum就可以使用了

猜你喜欢

转载自blog.csdn.net/weixin_42272246/article/details/111316339#comments_28714968