Redhat 7 yum安装软件时提示registered to Red Hat Subscription Management的解决方案

在使用redhat7的yum命令安装软件时,发现总是提示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.原来RHEL7的yum服务是付费的,因为没有付费,所以无法使用yum安装软件,只能替换为CentOs的yum工具,下面是具体操作步骤。

卸载yum

-- 查看yum
rpm -qa |grep yum

Redhat 7 yum安装软件时提示registered to Red Hat Subscription Management的解决方案_第1张图片

--卸载yum
rpm -qa | grep yum | xargs rpm -e --nodeps
或手动卸载关于yum的每个包
rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
rpm -e yum-3.4.3-118.el7.noarch --nodeps

切换到centos的yum

进入以下网站上面查看软件包的版本是否升级或者找到自己系统所对应的文件包版本更新;

  • 网易163网络源地址:http://mirrors.163.com/
  • CentOS网络源地址:http://centos.ustc.edu.cn/centos/
    下载centos的yum相关 rpm包,包下载地址为http://mirrors.163.com/centos/7/os/x86_64/Packages/,版本请从包下载地址获取最新的,可以用wget下载
python-kitchen-1.1.1-5.el7.noarch.rpm
python-chardet-2.2.1-3.el7.noarch.rpm
yum-3.4.3-167.el7.centos.noarch.rpm   
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-utils-1.1.31-53.el7.noarch.rpm
yum-updateonboot-1.1.31-53.el7.noarch.rpm 
yum-plugin-fastestmirror-1.1.31-53.el7.noarch.rpm
python-urlgrabber-3.10-10.el7.noarch.rpm 

安装软件包

rpm -ivh python-*
rpm -ivh yum-*

出现错误,需要调整为低版本
error: Failed dependencies:
python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-167.el7.centos.noarch
rpm >= 0:4.11.3-22 is needed by yum-3.4.3-167.el7.centos.noarch
安装的python-urlgrabber版本不符合您尝试安装的RPM的依赖关系,我目前没有能力解决这个问题的办法,

使用低版本的rpm包进行测试

yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm

安装rpm -ivh yum-*
Redhat 7 yum安装软件时提示registered to Red Hat Subscription Management的解决方案_第2张图片

切换到/etc/yum.repos.d/目录,从这里下载repo文件到/etc/yum.repos.d/目录,比如wget http://mirrors.aliyun.com/repo/Centos-7.repo

这里也提供几个其他repo文件

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

清除缓存

yum clean all

可以用yum search vim测试

订阅插件提示:This system is not registered with an entitlement server. You can use subscription-manager to register.
这个Red Hat Subscription Manager订阅管理器,它会让你一直register,解决办法:禁用就好
脚本文件: /usr/lib/yum-plugins/subscription-manager.py
配置文件: /etc/yum/pluginconf.d/subscription-manager.conf
调用了脚本 /usr/share/rhsm/repolib.py
去重写或者更新/etc/yum.repos.d/redhat.repo文件。
每次yum调用(不禁掉plugins的情况下),都会更新此文件。
因此,为了不冲突,可以如下操作:停止掉该插件的使用,在配置文件中把enable=0即可。

[root@micocube ~] vim /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0           #将它禁用掉

你可能感兴趣的:(linux编程,yum)