Pages

Sunday, 1 January 2012

解決未注册的RedHat Enterprise linux無法使用YUM命令的问题

沒有註冊的RedHat Enterprise無法使用YUM去做RedHat Enterprise update或安裝package, 其實用Cent-OS的update是一樣的(這2個OS只差Logo長得不同), 因此:
1.  到/etc/yum.repos.d把rhel-debuginfo.repo 改為 rhel-debuginfo.repo.old
2. 刪yum cache檔, 把/var/cache/yum底下的所有目錄和file刪掉
3. 到/etc/yum.repos.d目錄下, 建立CentOS-Base.repo檔案, 檔案內容如下:
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/4/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.centos.org/centos/4/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirror.centos.org/centos/4/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirror.centos.org/centos/4/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirror.centos.org/centos/4/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://mirror.centos.org/centos/4/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

以上這樣就搞定了, 參考: http://www.atlaspost.com/landmark.php?id=793134


或是:

#cd /etc/yum.repos.d
#vi centos.repo      <==檔名可自定,但副檔名一定要.repo
將以下內容複製到centos.repo並儲存
[c5base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[c5updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[c5addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[c5extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[c5plus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

再來就是將yum的cache清除
#yum clean all
完成,下次你就可以在RHEL上使用YUM了
注意:以上方式只是用於,平時在家裡做練習時方便用,如果在公司使用請購買RedHat的正式授權,以確保系統的穩定度.
不然就是改用CentOS
絕對不要再正式環境使用無法做正常yum更新的RHEL這樣是非常不安全的,而且也違反軟體著作財產權。

No comments:

Post a Comment