RHEL 使用 CentOS 的 yum 源

===================================================================================
由于自己的 RHEL 没有注册,因此不能使用自带的 yum 来升级系统或者安装软件。
因为 CentOS 是 RHEL 的完整重新编译版本(当然要相互对应一样的版本号),所以 RHEL 是一定可以用 CentOS 的 yum 源的。
===================================================================================
【删除 RHEL 自带的 yum】
rpm -aq|grep yum|xargs rpm -e --nodeps
===================================================================================
【下载】以下四个文件:
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-3.2.19-18.el5.centos.noarch.rpm
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-2.el5.i386.rpm
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
===================================================================================
【安装】
rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-2.el5.i386.rpm
rpm -ivh yum-3.2.19-18.el5.centos.noarch.rpm
warning: yum-3.2.19-18.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum-fastestmirror is needed by yum-3.2.19-18.el5.centos.noarch
wget ftp://ftp.muug.mb.ca/mirror/centos/5.3/os/x86_64/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
rpm -ivh yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
warning: yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
yum >= 3.0 is needed by yum-fastestmirror-1.1.16-13.el5.centos.noarch
注意:安装的时候最好几个同时安装,如果单个安装的话可能会出现依赖问题。
出现了相互依赖的问题。

混在一起
rpm -ihv xxx.rpm yyyy.rpm
rpm -ivh yum-3.2.19-18.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

------------------------------------------------------------------------------------------------------------------------------------
最后,下载配置文件:
# wget http://sudone.com/download/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo
这样就可以用 CentOS 的 yum 源来更新系统和安装软件了。
------------------------------------------------------------------------------------------------------------------------------------
另外,附上 x86_64 系统使用 CentOS 的 yum 源需要下载的四个包:
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.19-18.el5.centos.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-2.el5.x86_64.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
===================================================================================
【自动运行 yum】
chkconfig --list yum
chkconfig --level 3 yum on

控制脚本 /etc/rc.d/init.d/yum,这个控制脚本激活了 /etc/cron.daily/yum.cron,而它又会使 cron 服务来在每日凌晨四点时进行自动的系统更新。
===================================================================================
/etc/yum.repos.d/CentOS-Base.repo
CentOS-5 yum 国内镜像服务 配置文件:

[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirror.be10.com/centos/5.0/os/$basearch/
http://ftp.iasi.roedu.net/mirrors/centos.org/centos/5.0/os/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://mirror.be10.com/centos/5.0/updates/$basearch/
http://ftp.iasi.roedu.net/mirrors/centos.org/centos/5.0/updates/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://mirror.be10.com/centos/5.0/addons/$basearch/
http://ftp.iasi.roedu.net/mirrors/centos.org/centos/5.0/addons/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras

baseurl=http://mirror.be10.com/centos/5.0/extras/$basearch/
http://ftp.iasi.roedu.net/mirrors/centos.org/centos/5.0/extras/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://mirror.be10.com/centos/5.0/centosplus/$basearch/
http://ftp.iasi.roedu.net/mirror ... tos/5.0/centosplus/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://mirror.be10.com/centos/5.0/contrib/$basearch/
http://ftp.iasi.roedu.net/mirrors/centos.org/centos/5.0/contrib/$basearch/
http://ftp.hostrino.com/pub/centos/5.0/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
===================================================================================
参考:
http://withpython.appspot.com/2009/07/25/Linux.html
http://linux.chinaunix.net/bbs/viewthread.php?tid=845200
http://linux.chinaunix.net/bbs/archiver/?tid-1141321.html
http://kpshare.blog.51cto.com/1195439/274730
http://wirless.blog.51cto.com/933360/309915
http://kpshare.blog.51cto.com/1195439/274733


原文:http://hi.baidu.com/qu6zhi/blog/item/7533b0f4cc7944d3f2d3858b.html

猜你喜欢

转载自zhang1120peng.iteye.com/blog/752096