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

在這裏插入圖片描述

--卸載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-*
在這裏插入圖片描述

切換到/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           #將它禁用掉
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章