跳转至

centos5.8的配置yum和epel

配置yum

由于国内已经没有维护的yum源了, 大多已经失效, 找了好久找到了一个国外维护的源, 所以修改配置 /etc/yum.repos.d/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-5.8 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

#released updates 
[updates]
name=CentOS-5.8 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5.8 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.8 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5.8 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=contrib
baseurl=http://vault.centos.org/5.8/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=http://vault.centos.org/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

配置epel

理由如上, 修改 /etc/yum.repos.d/epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://archives.fedoraproject.org/pub/archive/epel/5/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5

更新

yum clean all
yum makecache
yum update

其他方案

1、下载CentOS镜像文件(下载地址如果失败,需自己寻找)到/data/目录下;

wget -0 /data/ http://vault.centos.org/5.8/isos/x86_64/CentOS-5.8-x86_64-bin-DVD-1of2.iso

2、挂载镜像文件

mount -o loop CentOS-5.8-x86_64-bin-DVD-1of2.iso /mnt/

3、修改yum配置文件

vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///mnt/
gpgcheck=0

4、

yum clean all
yum makecache