使用 Yum 时返回错误

使用 Yum 时返回错误

当我尝试使用 Yum(例如# yum update)时,出现错误,导致我无法使用 Yum。任何帮助都将非常有帮助!

这是我尝试运行 Yum 命令时收到的错误:

# yum update
Setting up Update Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - 4 is not a valid release or hasnt been released yet
Cannot find a valid baseurl for repo: update
Error: Cannot find a valid baseurl for repo: update

这是文件的内容CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=1

#released updates 
[update]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=1 

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=0 

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=0 

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=0 

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
protect=0

提前致谢!马克斯·库里克

答案1

您可以执行以下操作:

  1. /etc/yum.repos.d/CentOS-Base.repo在编辑器中打开
  2. 注释掉“镜像列表”条目。
  3. 取消注释“baseurl”条目并将其更改为

    http://vault.centos.org/4.9/os/$basearch
    

或者更好的是,停止使用不受支持的操作系统。

答案2

请让我们知道 /etc/yum.repos.d/ 中的 .repo 文件

尝试

grep -iRl 更新 /etc/yum.repos.d/

并在 .repo 文件中找到 update 的实例。可能你需要把

启用=0

对于“更新”的存储库文件部分

否则,尝试打开 /etc/yum.repos.d/ 中的每个 .repo 文件并检查 repo 部分“update”,如果您发现任何内容,请尝试通过将 0 置于启用行来禁用它。

让我们知道这是否适合您

答案3

同样的问题,

#rpm -q centos-release
centos-release-4-4.3

尝试通过以下方式更改 /etc/yum.repos.d/CentOS-Base.repo:http://vault.centos.org/4.8/CentOS-Base.repo

它对我有用。

相关内容