分享

解决Redhat Linux5 yum出现This system is not registered with RHN的方案 | 黄克业的博客

 善哉善斋 2013-11-26
最近博主在学习Linux,菜鸟级别的的选手连装个Chrome都觉得难,悲了个催的……百度了很多教程,大多是类似的。博主的配置是在VM8下搭建的RHEL5.3 (Tikanga)版本,不知道什么原因,每次在输入yum install google-chrome-stable之后就会出现“This system is not registered with RHN”的错误提示,蛋疼不已。百度无果后,GG大神帮上忙了(搜索Redhat This system is not registered with RHN,会冒出很多国外大牛的文章)。出现这个错误的原因是你的Linux木有花钱在红帽网络上注册^^,所以无法下载谷歌Chrome的软件包,解决方案可以使用从Redhat演化而来的免费Linux版本CentOS,通过CentOS的yum更新源来实现RHEL5的YUM功能。下面博主结合GG到的国外文章谈谈How to Install CentOS YUM on Redhat Linux RHEL5,以此来解决This system is not registered with RHN的问题。

1 check what yum package installed

查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

  1. [root@localhost ~]# rpm -qa |grep yum
  2. yum-metadata-parser-1.0-8.fc6
  3. yum-3.0.1-5.el5
  4. yum-rhn-plugin-0.4.3-1.el5
  5. yum-updatesd-3.0.1-5.el5

2 remove all installed yum packages

卸载上面显示的所有yum包:

  1. [root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
  2. 再用
  3. [root@localhost ~]# rpm -qa |grep yum查看,无信息显示表示已经卸载完成。

3 download the centos packages from website

下载 CentOS YUM包,首先我们需要找到CentOS YUM的更新源,推荐的有(前三个适用于Redhat Linux5版本,最后一个适用于RHEL6的64位版本,当然不管是RHEL5还是RHEL6等等都可以从下面四个镜像网站中下载):

  1. 1.国外镜像源http://ftp.heanet.ie/pub/centos/5/os/i386/CentOS/
  2. 2.中国科技大学http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
  3. 3.网易开源镜像http://mirrors.163.com/centos/5/os/i386/CentOS/
  4. 4.搜狐开源镜像http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/

接着我们就需要在终端里面输入以下命令进行下载(以博主的RHEL5.3为例,从中国科大下载镜像,下载的目录如果没设置的话就会默认是[root@localhost ~]# pwd显示的路径)

  1. [root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
  2. fastestmirror-1.1.16-21.el5.centos.noarch.rpm
  3. [root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
  4. metadata-parser-1.1.2-4.el5.i386.rpm
  5. [root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
  6. 3.2.22-40.el5.centos.noarch.rpm
  7. [root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
  8. python-iniparse-0.2.3-6.el5.noarch.rpm

4 安装这所下载的四个包

注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可:

  1. [root@localhost ~]# rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
  2. yum-metadata-parser-1.1.2-4.el5.i386.rpm
  3. yum-3.2.22-40.el5.centos.noarch.rpm
  4. yum-3.2.22-40.el5.centos.noarch.rpm
  5. //或者
  6. [root@localhost ~]# rpm ivh yum-*

5 download configure file

下载CentOS-Base.repo到/etc/yum.repos.d/文件夹里:
  1. [root@localhost ~]# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
  2. -O /etc/yum.repos.d/CentOS-Base.repo
  3. [root@localhost ~]# wget http://huangkeye-blog.googlecode.com/files/CentOS-Base.repo
  4. -O /etc/yum.repos.d/CentOS-Base.repo(以上这两个适用于RHEL版本5
  5. [root@localhost ~]# wget http://my-project-huangkeye.googlecode.com/files/CentOS-Base.repo
  6. -O /etc/yum.repos.d/CentOS-Base.repo(这个适用于RHEL版本6)

也可以直接进入vim修改该文件为以下内容:

  1. [base]
  2. name=CentOS-5 - Base
  3. baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
  4. gpgcheck=1
  5. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  6.  
  7. #released updates
  8. [update]
  9. name=CentOS-5 - Updates
  10. baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
  11. gpgcheck=1
  12. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  13.  
  14. #packages used/produced in the build but not released
  15. [addons]
  16. name=CentOS-5 - Addons
  17. baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
  18. gpgcheck=1
  19. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  20. #additional packages that may be useful
  21. [extras]
  22. name=CentOS-5 - Extras
  23. baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
  24. gpgcheck=1
  25. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  26.  
  27. #additional packages that extend functionality of existing packages
  28. [centosplus]
  29. name=CentOS-5 - Plus
  30. baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
  31. gpgcheck=1
  32. enabled=0
  33. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  34.  
  35. #contrib - packages by Centos Users
  36. [contrib]
  37. name=CentOS-5 - Contrib
  38. baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
  39. gpgcheck=1
  40. enabled=0
  41. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
  42.  
  43. #packages in testing
  44. [testing]
  45. name=CentOS-5 - Testing
  46. baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/
  47. gpgcheck=1
  48. enabled=0
  49. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

6 [选做]clear cache and rebuild

需要清除和重建cache:

  1. [root@localhost ~]# yum clean metadata
  2. [root@localhost ~]# yum clean dbcache
  3. [root@localhost ~]# yum makecache

7 installation has been completed, testing

  1. //安装成功,开始测试:
  2. [root@localhost ~]# yum update

8 Yum百科 :

  1. RHEL安装软件包管理器Yum(全称为 Yellow dog Updater, Modified)是一个在FedoraRedHat以及SUSECentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多