感谢支持
我们一直在努力

RedRat Enterprise Linux 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就可以更新了。简单吧(*^__^*) 嘻嘻……
以下是我更新的解图:


??



但是还没完,下载完所有更新包后会提示:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897


?


这是由于yum没有安装相应版本的GPG keys造成的。


必须要从CentOS5.5的?/etc/pki/rpm-gpg/下所有文件替换掉RedHat的/etc/pki/rpm-gpg/所有文件。


CentOS的/?etc/pki/rpm-gpg/下只有RPM-GPG-KEY-beta和RPM-GPG-KEY-CentOS-5


?RPM-GPG-KEY-beta的内容是:



?



—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG v1.2.6 (GNU/Linux)


mQGiBEWfBuERBACrwDH+6QvpyaOgzhXiemsIX+q4HlhX/HDmrmZOUd7i9VmZNogP
6LRRiTygn2+UphaGV3NDA36ZB/1JRpgvgpzbpZNeAoFvsljIbxGIwkH2JgRF6oNo
eGB3QYzDQJvYVIejk79M0ed3oor4w8OiNVcdxLyVIthFrjrrCqwRP3bLZwCgtY9t
Ezf5WL63Ue45vdht7A2GH+0D/iNAnWKsU7FUMFZrcwMaMbyP7YG8z0+zXUOgtgyP
tbgJG5yikNT3vJypb42gbKfcriUUDC5AeiRmkR8QPvYuOm34rM90+wx2LGqXWnHM
IyLAyl8TS3MQmePem8bfTGTNYxtt3Q7iadez2WYTLBSlmM6hbxZfdwm1hhyM0AJU
YyFUA/9kHH+CUBxKb1UgG7TSp53Po/5p/Yyuty+RJ7zIGv6SiN/JK4/ntWfm5WS5
ZprSdE5ODoFQ/Gs3/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Cwc6I23fdI0ur52bzEqHiAIswNfO521YgLk2W1xyCLc2aYjc8Ni
nrMX1tCnEx0/gK7ICyJoWH1Vc7//79sWFtX2EaTO+Q07xjFX4E66WxJlCo9lOjos
Vk5qc7R+xzLDoLGFtbzaTRQFzf6yr7QTu+BebWLoPwNTiE8EGBECAA8FAkWfB7MC
GwwFCRLMAwAACgkQqKRH3OhWKJfvvACfbsF1WK193zM7vSc4uq51XsceLwgAoI0/
9GxdNhGQEAweSlQfhPa3yYXH
=o/Mx
—–END PGP PUBLIC KEY BLOCK—–

拷到RedHat的相应目录下后,终端运行?#rpm –import /etc/pki/rpm-gpg/RPM*


再运行yum -y update,?就OK了。


?


可以看到采用CentOS的yum源,全部更新完后桌面也变成的CentOS默认的壁纸o(╯□╰)o

赞(0) 打赏
转载请注明出处:服务器评测 » RedRat Enterprise Linux 5.4用CentOS 5.5 yum源替换
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏