Redhat订阅操作

一、注册RedHat订阅

~]# sudo subscription-manager register --auto-attach --username=XXX --password=XXX
~]# subscription-manager repos --enable=rhel-7-server-extras-rpms

# 配置使用中国的RHEL yum源
~]# subscription-manager config --rhsm.baseurl=https://china.cdn.redhat.com
~]# subscription-manager refresh
~]# yum clean all
~]# yum makecache

二、取消注册RedHat订阅

~]# subscription-manager unregister

三、取消默认yum订阅注册功能

使用YUM时提示如下:

[root@ajunyu ~]# yum install yum-utils 
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile

原因:
https://blog.csdn.net/oraoharu/article/details/106808108
这个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@ajunyu ~]# vim /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0

再次安装

[root@ajunyu ~]# yum install yum-utils
Loaded plugins: fastestmirror, product-id, search-disabled-repos
Loading mirror speeds from cached hostfile
    * base: mirrors.aliyun.com
    * elrepo: mirrors.tuna.tsinghua.edu.cn
    * extras: mirrors.aliyun.com
    * updates: mirrors.aliyun.com
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
posted @ 2022-04-15 20:52  彬彬l  阅读(839)  评论(0编辑  收藏  举报