Redhat Enterprise 5.4用CentOS 5.5 yum源替换(原创)
要使用CentOS的源,就得将RHEL的更新源移除,或是禁用掉,并且需要将RHEL5自带的YUM工具删除。
#cd /etc/yum.repos.d
#mv rhel-debuginfo.repo rhel-debuginfo.repo.bak
此处将其备份起来,供意外恢复时使用,删除rhel-debuginfo.repo。如有其他的相关的源设置,都要删除,
或是采用以上方法备份。删除RHEL5自带的YUM及YUM组件:
使用rpm -qa | grep yum列出所有相关的包,把它们都删掉,如果因依赖性不能删除,就使用--nodeps参数删除。
用rpm -qa | grep yum再次查看,如果都没有,就说明都卸载完毕。
下面就可以来进行CentOS源的设置了:
首先,我们需要下载安装CentOS的YUM工具:
yum-3.2.22-26.el5.centos.noarch.rpm 下载地址:http://centos.ustc.edu.cn/centos/5.5/os/i386/CentOS/yum- 3.2.22-26.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm 下载地址: http://centos.ustc.edu.cn/centos/5.5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm 下载地址: http://centos.ustc.edu.cn/centos/5.5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
以上三个都要加--nodeps 安装。
然后复制CentOS5.5的/etc/yum.repos.d下的有且仅有两个的CentOS-Media.repo和CentOS-Base.repo到Redhat Enterprise 5.4相同的目录下。
省的大家再去装CentOS5.5我把这两个文件的内容复制出来,只要保存为同名文件放到/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-$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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
CentOS-Media.repo的内容如下:
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c5-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
在保存完到相应的目录下后:
替换CentOS-Base.repo中的$releasever为5.5,保存,运行yum -y update就可以更新了。简单吧(*^__^*) 嘻嘻……: