subscription-manager listsubscription-manager register --username='hoge' --password='fuga'subscription-manager unregister2024.10.01 現在、SCAにより、サブスクリプションをアタッチしなくても register 時に自動的にサブスクリプション(yumリポジトリ)へのアクセスが可能になるため、以下の attach/remove は不要になり、register/unregister だけでよくなった模様。
subscription-manager list --availablesubscription-manager list --available --pool-onlysubscription-manager attach --pool <poolid>subscription-manager remove --allsubscription-manager register を実行すると、新しいサブスクリプションが作成される。
(参考) How to activate your no-cost Red Hat Enterprise Linux subscription
(例)
# Dokcer で RHEL のコンテナを起動
$ docker run -it --rm -v /vagrant:/vagrant --name rh8 registry.access.redhat.com/ubi8/ubi:8.4 /bin/bash
# サブスクリプションを登録 => このコンテナでサブスクリプションを 1つ消費することになるので、後で解除。
$ subscription-manager register --username=hoge --password=pass
Registering to: subscription.rhsm.redhat.com:443/subscription
The system has been registered with ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
The registered system name is: xxxxxxxxxxxx
# このシステム(コンテナ)からサブスクリプションの使用を解除。
$ subscription-manager unregister
(参考)
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm