[步骤] RHEL 系统的注册 (注册到 Red Hat 官网)

正文:

步骤一:清除旧有的注册信息

1.1 清除所有的旧有注册信息

# subscription-manager remove --all

1.2 取消注册

# subscription-manager unregister

1.3 清楚所有的就有数据

# subscription-manager clean

1.4 确保所有 satellite 客户端安装包已经删除

# yum remove katello-ca-consumer-*

步骤二:确保 RHEL 系统的注册网站指向 Red Hat 官网

# vim /etc/rhsm/rhsm.conf

确保部分内容如下:

......
hostname = subscription.rhsm.redhat.com
......
baseurl = https://cdn.redhat.com
......

步骤三:注册 RHEL 系统到 Red Hat 官网

3.1 非交互式

# subscription-manager register --username <username> --password <password> --auto-attach

(注意:如果完成了本文的 2.1 就不用再执行 本文的 2.2 了)

3.2 交互式注册 RHEL 系统到 Red Hat 官网

3.2.1 交互式注册 RHEL 系统到 Red Hat 官网
# subscription-manager register
3.2.2 在 Red Hat 官网上将相关订阅 (license) 分配给系统

登录 Red Hat 官网 –> Red Hat Customer Portal –> subscriptions –> systems –> <system name> –> 添加订阅

3.2.3 刷新订阅
# subscription-manager refresh

参考文献:

https://access.redhat.com/solutions/253273

[排错] 解决 Red Hat Satellite 发布新版本 Content Views 时报错 “Unable to find content with the ID “……””

报错代码

Unable to find content with the ID "......"

分析

当 Content Views 里包含有问题的软件源时,发布新版本 Content View 时就会报此类错误

解决方法

步骤一:根据报错时出现的 ID 显示出问题的软件名称

# su - postgres -c "psql candlepin -c \"select uuid, content_id, contentUrl, label, type, vendor from cp2_content where content_id = '9210'\""

(补充:这里以显示 ID 9210 的软件名称为例)

步骤二:给服务器系统打一个快照

(步骤略)

步骤三:强制停止出问题的任务

Monitor –> Tasks –> Paused –> “select the task which publish a new Content View version” –> Cancel

(注意:操作前需要确保左上角的组织是否正确)

或者:

步骤三:将出问题的软件源从要布新版本的 Content Views 里删除

Content –> Content Views –> “select the Content View which whill publish a new version” –> Yum Content –> Repository –> “select the repository which is error” –> Remove Repositories

步骤四:重新发布新版本的 Content Views

(步骤略)

[步骤] Red Hat Satellite 无法停止任务的强制停止

步骤一:打一个快照

(步骤略)

步骤二:显示运行结果是错误的任务

# sudo su - postgres -c "psql -d foreman -c 'select label,count(label),state,result from foreman_tasks_tasks where state <> '\''stopped'\'' group by label,state,result ORDER BY label;'"
                        label                         | count |   state   | result  
------------------------------------------------------+-------+-----------+---------
 Actions::Katello::ContentView::Publish               |     1 | paused    | error
 ......

(补充:从这里可以看出运行结果是错误的任务标签是 Actions::Katello::ContentView::Publish)

步骤三:强制停止 Red Hat Satellite 无法停止的任务

# foreman-rake foreman_tasks:cleanup TASK_SEARCH='label = Actions::Katello::ContentView::Publish' STATES='paused' VERBOSE=true

(补充:这里以强制停止标签为 Actions::Katello::ContentView::Publish 的任务为例)

[步骤] Red Hat Satellite Content View 信息的显示

步骤一:显示所有 Content View 的 ID

# hammer content-view list

----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------------------------------------------------------------------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS                                                                  
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------------------------------------------------------------------------
10              | test_CV                   | test_CV                              | false     | 2022/06/23 20:20:20 | 61525, 16812, 61524, 16814, 16813, 16811, 16816, 16817, 6578, 231, 8, 9, 131,...

步骤二:显示某 1 个 Content View 的详细信息

# hammer content-view info --id 10

(补充:这里以显示 ID 为 10 的 Content View 的信息为例)

[步骤] Red Hat Satellite 打补丁或升级

步骤一:备份系统

1.1 关闭 Red Hat Satellite 服务

# satellite-maintain service stop

1.2 备份系统

(补充:这里以备份虚拟环境下的 Red Hat Satellite 为例)

1.2.1 关闭系统
# poweroff
1.2.2 给系统打快照

(步骤略)

1.2.3 启动系统

(步骤略)

步骤二:升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁

2.1 检测可升级 RedHat Satellite 版本

# satellite-maintain upgrade list-versions

2.2 预检测升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁是否能成功

# satellite-maintain upgrade check --target-version 6.10.z

(注意:如果是升级 Red Hat Satellite 的话就指定最新的版本,如果是给 Red Hat Satellite 打补丁的话就选择当前的版本)

(补充:这里以指定 6.10.z 版本的 Red Hat Satellite 为例)

2.3 升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁

# satellite-maintain upgrade run --target-version 6.10.z


注意:
1) 只有当预检测升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁成功后才能接着执行此步骤
2) 如果是升级 Red Hat Satellite 的话就指定最新的版本,如果是给 Red Hat Satellite 打补丁的话就选择当前的版本

(补充:这里以指定 6.10.z 版本的 Red Hat Satellite 为例)

步骤三:重启 Red Hat Satellite

3.1 关闭 Red Hat Satellite 服务

# satellite-maintain service stop

3.2 重启 Red Hat Satellite

# reboot