Red Hat Enterprise Linux Server(RHEL) yum安裝軟體時This system is not registered with RHN. RHN support will be disabled. Red Hat Enterprise Linux Server(RH ...
Red Hat Enterprise Linux Server(RHEL) yum安裝軟體時This system is not registered with RHN. RHN support will be disabled.
Red Hat Enterprise Linux Server(RHEL) 的yum服務是付費的,因為沒有付費,所以無法使用yum安裝軟體,如RHEL想安裝LNMP必須要先按此教程設置好yum,並可以正常使用後才可以安裝LNMP一鍵安裝包,會提示如下錯誤:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 或如下錯誤信息:This system is not registered with RHN. RHN support will be disabled.解決方法:
執行:rpm -qa|grep yum|xargs rpm -e --nodeps 將yum卸載掉
cat /etc/issue && uname -a 看一下系統版本號和系統位數
到 http://mirrors.kernel.org/centos/ 或 http://mirrors.163.com/centos/ 找對應系統版本號
如果系統是5.* 64位,則打開http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/
如果系統是5.* 32位,則打開http://mirrors.kernel.org/centos/5/os/i386/CentOS/
如果系統是6.* 32位:http://mirrors.kernel.org/centos/6/os/i386/Packages/
如果系統是6.* 32位:http://mirrors.kernel.org/centos/6/os/i386/Packages/
找到yum 、yum-fastestmirror、yum-metadata-parser 這3個軟體包的地址,然後執行:以下命令下載地址可能會無法下載,到上面網址找對應的下載文件!下麵是以RHEL 5.* 64位 為例,下麵下載地址里的鏈接可能會變,自行更換下載地址
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
下載下這3個軟體包,再執行:
rpm -ivh yum-*
再執行:(如果是6.*的版本,則將下麵內容裡面的5改成6,同時將下麵文件里的$releasever全部替換為版本號5或6後再執行。)
cat >/etc/yum.repos.d/CentOS-Base.repo<<eof [base] name=CentOS-$releasever - Base baseurl=http://mirrors.kernel.org/centos/$releasever/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.kernel.org/centos/$releasever/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates 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-$releasever - Addons baseurl=http://mirrors.kernel.org/centos/$releasever/addons/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.kernel.org/centos/$releasever/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.kernel.org/centos/$releasever/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib baseurl=http://mirrors.kernel.org/centos/$releasever/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 eof
Note:
1) 如果是 7,沒有addons,可以將[addons]區域的配置移除。
2) gpgkey 的版本號要與下載的版本是一致的。
3)使用上述腳本時,要將變數$releaserver 代表的是系統版本號,$basearch 代表的是 arch 版本(例如x86_64)