文档中心 > 云服务器 ECS

CentOS系统中执行yum命令报错

更新时间: 访问次数:2137

概述

本文主要介绍在CentOS 5系统中执行yum命令报错的解决方法。

问题症状

执行 yum install等命令,产生错误。

问题原因

配置的yum源出错,在mirrors.aliyun.com/centos/5/中没有如下截图中的文件,只有一个readme文件。

解决方案

  1. 修改CentOS-Base.repo配置文件,修改后文件内容如下。
    # CentOS-Base.repo
    #
    # The mirror system uses the connecting IP address of the client and the
    # update status of each mirror to pick mirrors that are updated to and
    # geographically close to the client.  You should use this for CentOS updates
    # unless you are manually picking other mirrors.
    #
    # If the mirrorlist= does not work for you, as a fall back you can try the 
    # remarked out baseurl= line instead.
    #
    #
     
    [base]
    name=CentOS-$releasever - Base - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/os/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    gpgcheck=1
    gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
     
    #released updates 
    [updates]
    name=CentOS-$releasever - Updates - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/updates/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    gpgcheck=1
    gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
     
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/extras/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    gpgcheck=1
    gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
     
    #packages used/produced in the build but not released
    [addons]
    name=CentOS-$releasever - Addons - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/addons/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
    gpgcheck=1
    gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
     
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    gpgcheck=1
    enabled=0
    gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
     
    #contrib - packages by Centos Users
    [contrib]
    name=CentOS-$releasever - Contrib - mirrors.aliyun.com
    failovermethod=priority
    baseurl=http://vault.centos.org/5.11/contrib/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
    gpgcheck=1
    enabled=0
    gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5
  2. 重新执行yum命令,恢复正常。

适用于

  • 云服务器ECS

FAQ

关于此文档暂时还没有FAQ
返回
顶部