redhat替換yum源時redhat.repo無法刪除或禁用的問題提示:This system is not registered with an entitlement server.
阿新 • • 發佈:2018-11-01
redhat替換yum源時redhat.repo無法刪除或禁用的問題提示:This system is not registered with an entitlement server.You can use subscription-manager to register.
今天新裝的rhel7.5,在替換自帶的repo源時發現無論是將redhat.repo重新命名還是刪除,在執行yum命令後總是自動又生成redhat.repo得問題,導致替換的CentOS-Base.repo,一直無法使用的。
- 問題1:無法使用yum
[[email protected]
yum.repos.d]# yum clean all Loaded plugins: fastestmirror, product-id, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Cleaning repos: base extras updates Cleaning up everything 配置的CentOS-Base.repo一直沒生效,他讓我們註冊才可以使用redhat; 沒註冊所以一直使用的是redhat.repo,
- 問題2:現在不想註冊用redhat源,而使用CentOS的源
- 執行yum命令後,檢視yum.repos.d/目錄下剛剛重新命名為redhat.repo.bak的repo又自動生成了一個redhat.repo
[[email protected] yum.repos.d]# ls
CentOS-Base.repo redhat.repo redhat.repo.bak
[[email protected] yum.repos.d]
- 這個redhat.repo一直無法刪除,執行yum命令後又會出現
如果你在redhat.repo中寫了
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
# ...
enabled=0
在執行yum命令後,最終會保留你的註釋行,而資料行enabled=0會被刪掉。
經過查詢,發現是redhat自帶的外掛subscription-manager給弄得的。而這個外掛的作用就是Red Hat Subscription Manager訂閱管理器,就是它讓你一直register
- 找到subscription-manage的配置檔案/etc/yum/pluginconf.d/subscription-manager.conf
[[email protected] pluginconf.d]# vim subscription-manager.conf
[main]
enabled=0 #將它禁用掉
~
...
[[email protected] pluginconf.d]#
- 再次重新生成yum快取終於大功告成,完成替換
[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
...
Metadata Cache Created
// 全部換成阿里雲的yum源了
[[email protected] yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,911
extras/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 402
updates/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,336
repolist: 11,649
[[email protected] yum.repos.d]#
subscription-manager訂閱管理器
指令碼檔案: /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的情況下),都會更新此檔案。
因此,為了不衝突,可以如下操作:
第一:重新命名自己的repo檔案,比如RHEL.repo
第二:停止掉該外掛的使用,在配置檔案中把enable=0即可。
為了不影響系統自帶功能,建議選取第一種方法,
另外,該現象好像只是rhel6系統存在,4和5沒有發現。