首页 > 代码库 > Linux:将rhel yum 切换到centos yum
Linux:将rhel yum 切换到centos yum
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位 为例,下面下载地址里的链接可能会变,自行更换下载地址
解决方法:
执行: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.rpmwget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpmwget 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 - Basebaseurl=http://mirrors.kernel.org/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#released updates [updates]name=CentOS-$releasever - Updatesbaseurl=http://mirrors.kernel.org/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-$releasever - Addonsbaseurl=http://mirrors.kernel.org/centos/$releasever/addons/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addonsgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasbaseurl=http://mirrors.kernel.org/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusbaseurl=http://mirrors.kernel.org/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribbaseurl=http://mirrors.kernel.org/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5eof
Note:
1) 如果是 7,没有addons,可以将[addons]区域的配置移除。
2) gpgkey 的版本号要与下载的版本是一致的。
3)使用上述脚本时,要将变量$releaserver 代表的是系统版本号,$basearch 代表的是 arch 版本(例如x86_64)
Linux:将rhel yum 切换到centos yum
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。