Redhat5和6 YUM源配置的区别

一、概述

随着各个软件版本的不断升级,我们需要掌握的软件特性也越来越多,技术的不断更新也促进了我们脑细胞的循环。 今天在配置RedHat6.3的yum源时也出现了一个有趣的事情,下面请听俺道来。

二、问题处理

问题源于哥们处,自己就搭建了一个测试的系统模拟环境,尽量还原。

由于操作系统无法挂在光盘,其实镜像也是可以拷进系统的,但系统镜像太大,也就是偷懒的做法,只是将几个需要的包考过去。简单来说点吧,实际环境也不一样

报错如下面所示:

[root@firsoul rpm]# /usr/bin/yum upgrade

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

file:///soft/rpm/repodata/repomd.xml: [Errno 14] Could not open/read file:///soft/rpm/repodata/repomd.xml

Trying other mirror.

Setting up Upgrade Process

No Packages marked for Update

根据以上提示,将该缺失文件拷贝到相应目录,还是报错,错误如下,查看相关资料,应该之前系统yum源有缓存(具体配置信息以及系统环境并没有详细查看),当时没有尝试使用yum clean all命令。

[root@linuxidc yum.repos.d]# /usr/bin/yum upgrade

Loaded plugins: refresh-packagekit, security

http://public-yum.Oracle.com/repo/OracleLinux/OL6/UEKR3/latest/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host ‘public-yum.oracle.com'”

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: public_ol6_UEKR3_latest. Please verify its path and try again

[root@linuxidc yum.repos.d]#

由于很久没有用Redhat6以上系统了,只是在Redhat5.4系统上做测试,我将Server中所需要的rpm包考入制定目录,并将Server目录下repodata拷贝到制定目录,即可安装。让其查找目录repodata,在RPM所属目录(Packages)并没有发现。突然想起,配置Redhat6.0以上系统时,yum源所写目录并非指定到rpm所在目录Packages,还是指定Server目录,查看Redhat6的下Server目录,发现文件repomd.xml。其实Redhat5和redhat6只是rpm包所在位置发生变化(6是在Server同目录Packages下),6的Server目录中多出几个包以及rpm包清单文件,在制定yum时,6的目录还是要制定到Server目录。其实根据yum报错我们比较容易解决。也就是不管5还是6,repodata目录还是在Server下。

由于哥们比较着急,无法再查看原因,我就让他用rpm按照所需软件。给我发来一下错误信息

[root@linuxidc Packages]# rpm -ivh glibc-2.12-1.132.el6.i686.rpm

error: Failed dependencies:

libfreebl3.so is needed by glibc-2.12-1.132.el6.i686

libfreebl3.so(NSSRAWHASH_3.12.3) is needed by glibc-2.12-1.132.el6.i686

[root@linuxidc Packages]# rpm -ivh nss-softokn-freebl-3.14.3-9.el6.i686.rpm

error: Failed dependencies:

libc.so.6 is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.0) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.1) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.1.3) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.3) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.3.4) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.4) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libc.so.6(GLIBC_2.7) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libdl.so.2 is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libdl.so.2(GLIBC_2.0) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

libdl.so.2(GLIBC_2.1) is needed by nss-softokn-freebl-3.14.3-9.el6.i686

由上面信息,我们可以看出,尤其标明黄色部分,安装glibc软件需要依赖的包为libfreebl3.so 然后他就安装该包,还是报错。他忽略了后边的一行,libfreebl3.so包也依赖glibc软件包,所以需要将两个rpm包同时执行。结果如下:

[root@linuxidc Packages]# rpm -ivh glibc-2.12-1.132.el6.i686.rpm nss-softokn-freebl-3.14.3-9.el6.i686.rpm

Preparing…                ########################################### [100%]

1:nss-softokn-freebl    ########################################### [ 50%]

2:glibc                  ########################################### [100%]

[root@linuxidc Packages]#

三、 总结

  这个总结不知道怎么说了,一个是要了解新系统一些改变以及新特性,在这操作过程中需要认真点,其实他那个yum问题还未根本解决,只是把glibc软件安装完事就撤了,有机会再跟踪一下。在很多情况下,我们并没有被偏难的技术所阻碍,而是被一些习惯、马虎所桎梏。认真、多变(脑子灵活一点),问题往往迎刃而解,当然,自身技术能力也要达到一定级别,我只是在慢慢的学习中。

RedHat 6.2 Linux修改yum源免费使用CentOShttp://www.linuxidc.com/Linux/2013-07/87383.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

Redhat 本地yum源配置 http://www.linuxidc.com/Linux/2012-11/75127.htm

yum的配置文件说明 http://www.linuxidc.com/Linux/2013-04/83298.htm

RedHat 6.1下安装yum(图文) http://www.linuxidc.com/Linux/2013-06/86535.htm

YUM 安装及清理 http://www.linuxidc.com/Linux/2013-07/87163.htm

CentOS 6.4上搭建yum本地源 http://www.linuxidc.com/Linux/2014-07/104533.htm

更多RedHat相关信息见RedHat 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=10