1. 程式人生 > >解決Redhat yum出現This system is not registered with RHN的方案

解決Redhat yum出現This system is not registered with RHN的方案

article repos 大學 nbsp get linu 中國 roo 國外

最近博主在學習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包:

[[email protected] ~]# rpm -qa |grep yum

yum-metadata-parser-1.0-8.fc6

yum-3.0.1-5.el5

yum-rhn-plugin-0.4.3-1.el5

yum-updatesd-3.0.1-5.el5

2 remove all installed yum packages

卸載上面顯示的所有yum包:

[[email protected] ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不檢查依賴,直接刪除rpm包)

再用

[[email protected] ~]# rpm -qa |grep yum

[[email protected] ~]#

查看,無信息顯示表示已經卸載完成。

3 download the centos packages from website

下載 CentOS YUM包,首先我們需要找到CentOS YUM的更新源,推薦的有(前三個適用於Redhat Linux5版本,最後一個適用於RHEL6的64位版本,當然不管是RHEL5還是RHEL6等等都可以從下面四個鏡像網站中下載):

1.國外鏡像源http://ftp.heanet.ie/pub/centos/5/os/i386/CentOS/

2.中國科技大學http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/

3.網易開源鏡像http://mirrors.163.com/centos/5/os/i386/CentOS/

4.搜狐開源鏡像http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/

接著我們就需要在終端裏面輸入以下命令進行下載(以博主的RHEL5.3為例,從中國科大下載鏡像,下載的目錄如果沒設置的話就會默認是[[email protected] ~]# pwd顯示的路徑)

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm

如果是Redhat 64位系統,按如下進行下載:

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

[[email protected] ~]# wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm

4 安裝這所下載的四個包

註意:單個的安裝包可能會依賴其它包(例如yum和yum-fastestmirror會相互依賴),所以我們可以把所有這些包放在一起,用一行命令將它們同時安裝即可:

[[email protected] ~]# rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.i386.rpm yum-3.2.22-40.el5.centos.noarch.rpm

對應Redhat 64位系統的操作如下:

[[email protected] ~]# rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.x86_64.rpm yum-3.2.22-40.el5.centos.noarch.rpm

5 download configure file

下載CentOS-Base.repo到/etc/yum.repos.d/文件夾裏: [[email protected] ~]# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

-O /etc/yum.repos.d/CentOS-Base.repo

[[email protected] ~]# wget http://huangkeye-blog.googlecode.com/files/CentOS-Base.repo

-O /etc/yum.repos.d/CentOS-Base.repo(以上這兩個適用於RHEL版本5)

[[email protected] ~]# wget http://my-project-huangkeye.googlecode.com/files/CentOS-Base.repo

-O /etc/yum.repos.d/CentOS-Base.repo(這個適用於RHEL版本6) 也可以直接進入vim修改該文件為以下內容:

[base]

name=CentOS-5 - Base

baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates

[update]

name=CentOS-5 - Updates

baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-5 - Addons

baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

也可以直接進入vim修改該文件為以下內容:

[base]

name=CentOS-5 - Base

baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates

[update]

name=CentOS-5 - Updates

baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-5 - Addons

baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages in testing

[testing]

name=CentOS-5 - Testing

baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

6 [選做]clear cache and rebuild

需要清除和重建cache:

[[email protected] ~]# yum clean metadata

Loaded plugins: fastestmirror

0 metadata files removed

0 sqlite files removed

0 metadata files removed

[[email protected] ~]# yum clean dbcache

Loaded plugins: fastestmirror

0 sqlite files removed

[[email protected] ~]# yum makecache

Loaded plugins: fastestmirror

Determining fastest mirrors

addons | 1.9 kB 00:00

addons/filelists_db | 568 B 00:00 addons/other_db | 546 B 00:00

addons/primary_db | 1.1 kB 00:00

base | 1.1 kB 00:00

base/filelists | 3.6 MB 00:03 base/other | 13 MB 00:13

base/group | 1.1 MB 00:02

base/primary | 1.2 MB 00:01

extras | 2.1 kB 00:00

extras/filelists_db | 241 kB 00:00

extras/other_db | 406 kB 00:00

extras/group | 9.7 kB 00:00

extras/primary_db | 188 kB 00:00

update | 1.9 kB 00:00 update/filelists_db | 3.1 MB 00:03

update/other_db | 15 MB 00:15

update/primary_db | 634 kB 00:00

base 3641/3641

base 3641/3641

base 3641/3641

Metadata Cache Created

[[email protected] ~]#

7 installation has been completed, testing

//安裝成功,開始測試:

[[email protected] ~]# yum update

出處:http://www.seacha.com/article.php/knowledge/linux/linuxbase/2013/0925/2216.html

解決Redhat yum出現This system is not registered with RHN的方案