首页 文章,Linux

YumRepo错误:所有镜像URL均未使用ftp,http [s]或文件。例如。无效的release / repo / arch组合/。

如您所知,Centos 6最近达到了使用寿命。因此,所有先前的存储库均已弃用。

因此,在CentOS 6服务器上运行yum命令时,您可能会看到以下错误。

[root@server ~]# yum
updateLoaded
plugins: fastestmirror
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
[root@server ~]#   

为了解决此问题,您需要修改文件/etc/yum.repos.d/CentOS-Base.repo

1.备份现有的CentOS Base存储库文件。

cp -pr /etc/yum.repos.d/CentOS- 
Base.repo /etc/yum.repos.d/CentOS- 
Base.repo.OLD

2.使用您喜欢的编辑器编辑文件/etc/yum.repos.d/CentOS-Base.repo。我在这里使用vim编辑器:

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

3.使用以下内容修改提到的文件:

[base]
name=CentOS-$releasever - Base

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra

baseurl=http://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://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://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

additional packages that extend functionality of existing packages

[centosplus]
name=CentOS-$releasever - Plus

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra

baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

contrib - packages by Centos Users

[contrib]
name=CentOS-$releasever - Contrib

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra

baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

4.运行所需的yum命令。我在这里运行yum更新:

yum update



文章评论