RHEL5如何使用CentOS更新yum源


今天第一天入职,新公司的服务器用的是RHEL,我个人是不太喜欢RHEL,没办法还是需要工作,汗

接到个要求,让安装几个软件包,以前在CentOS下用yum习惯了,用RHEL更新包一点都不好使;网上虽然有很多这方面的资料,但是实践以后的才是自己的,下面总结一下今晚的实践成果:

一、卸载掉系统中的yum包

[root@localhost ~]# rpm -qa |grep yum

yum-3.2.8-9.el5

yum-rhn-plugin-0.5.3-6.el5

yum-metadata-parser-1.1.2-2.el5

yum-security-1.1.10-9.el5

yum-updatesd-0.9-2.el5

[root@localhost ~]# rpm -qa |grep release

RedHat-release-notes-5Server-12

redhat-release-5Server-5.2.0.4

然后使用rpm -e packges  卸载这些软件包,有依赖关系的,使用--nodeps参数

二、下载CentOS中的yum包

#cd /  && mkdir yum  && cd yum

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/centos-release-5-6.el5.centos.1.i386.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/centos-release-notes-5.6-0.i386.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm

然后安装这些软件包,建议一起安装这些软件包,我碰到这个问题跟自身软件包依赖,我使用--nodeps参数

例如:rpm -ivh centos-release-5-6.el5.centos.1.i386.rpm --nodeps

三、最后,下载配置文件

wget http://sudone.com/download/CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo

cd /etc/yum.repos.d/

用vim编辑器编辑CentOS-Base.repo进行替换操作

:1,$s/$releasever/5.5/g   (注释:我的系统是5.5,所以这里我改成5.5)

四、导入import key

rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

最后测试yum -y install httpd

OK。

相关内容