Centos中执行yum update或yum install 时报Error: Cannot find a valid baseurl for repo: base错误
Posted 小坏蛋至尊宝
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos中执行yum update或yum install 时报Error: Cannot find a valid baseurl for repo: base错误相关的知识,希望对你有一定的参考价值。
执行命令报错如下图:
执行命令报如下错:
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
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
这是因为在CentOS 6在2020年11月30过后,就不在维护了,使用如下方法解决:
- 进入
/etc/yum.repos.d/
# cd /etc/yum.repos.d/
- 编辑
CentOS-Base.repo
# 先备份
# cp CentOS-Base.repo CentOS-Base.repo.old
# 编辑
# vim CentOS-Base.repo
- 编辑如下几个块
- [base]
- [updates]
- [extras]
- 修改内容如下:替换原有的
-
[base] name=CentOS-$releasever - Base # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra # baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ baseurl=https://vault.centos.org/6.10/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 # released updates [updates] name=CentOS-$releasever - Updates # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra # baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ baseurl=https://vault.centos.org/6.10/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 # additional packages that may be useful [extras] name=CentOS-$releasever - Extras # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra # baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ baseurl=https://vault.centos.org/6.10/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
- 清楚缓存
-
# yum clean all
- 重新执行更新
-
# yum update
以上是关于Centos中执行yum update或yum install 时报Error: Cannot find a valid baseurl for repo: base错误的主要内容,如果未能解决你的问题,请参考以下文章
yum -y upgrade与yum -y update的区别
CentOS下升级系统 yum update命令 自己配置更新源