RHELで地味にめんどくさいのがサブスクリプション関係です。
適用しないとyumとかできないのではじめにやっておく必要があります。
さくっと手順載せておきます。
※執筆当時、RHEL7での確認したものです。RHEL9現在はライセンス管理体系等が変わっていますので、参考までに…
※前提:カスタマーポータルのアカウント
https://access.redhat.com/management/
に利用可能なサブスクリプションが紐づいていること。
(参考)検証用ライセンス取得方法↓
https://qiita.com/SkyLaptor/items/31eb7b506339718455d4
!(2024/10追記)!
2024年10月末に全アカウントでSimple Content Access
の利用が強制されたため、
システムとサブスクリプションを対応づける必要はなくなり、
”アカウントが対応する製品を1つ以上保有しているか”だけを考慮するような動作となったようです。そのため、
# subscription-manager register
のみで yum/dnf が使えるようになりました。(が、ライセンス周りは自分で管理しないといけなくなります…)
参考までに、RHEL9.5上で確認したsubscription-manager コマンドのhelpです。
いくつかのコマンドが削除されると記載がありました。
[root@host02 ~]# subscription-manager --help
使用方法: subscription-manager モジュール名 [モジュールオプション] [--help]
プライマリーモジュール:
list このシステムのサブスクリプションと製品情報を表示します
refresh サーバーから最新のサブスクリプションデータを取得します
register カスタマーポータル、または別のサブスクリプション管理サービスに、このシステムを登録します
release 使用するオペレーティングシステムのリリースを設定します
status このシステムのサブスクリプションと製品に関するステータス情報を表示します
unregister カスタマーポータル、または別のサブスクリプション管理サービスから、このシステムの登録を取り消す
その他のモジュール:
addons 非推奨です、'syspurpose' を参照してください
attach Deprecated, this command will be removed from the future major releases. Attach a specified
subscription to the registered system, when system does not use Simple Content Access mode
auto-attach Deprecated, this option will be removed from the future major releases. Set if subscriptions are
attached on a schedule (default of daily)
clean サーバーには影響を与えずに、ローカルのシステムとサブスクリプションデータをすべて削除します
config このシステムで使用中の設定パラメータを表示、 設定、または削除します
environments ユーザーが使用可能な環境を表示します
facts 検出したシステム情報を表示、または更新します
identity このシステムの識別証明書を表示するか、 新しい証明書を要求します
import Deprecated, this command will be removed from the future major releases. This command is no-op in
simple content access mode. Import certificates which were provided outside of the tool
orgs システムを登録できる組織を表示します
plugins 'subscription-manager plugins' で表示および設定します
redeem Deprecated, this command will be removed from the future major releases. This command is no-op in
simple content access mode. Attempt to redeem a subscription for a preconfigured system
remove Deprecated, this command will be removed from the future major releases. This command is no-op in
simple content access mode. It tries to remove all or specific subscriptions from this system
repo-override カスタムのコンテンツリポジトリー設定を管理します
repos このシステムで使用権限があるリポジトリーを表示します
role 非推奨です、'syspurpose' を参照してください
service-level 非推奨です、'syspurpose' を参照してください
syspurpose すべてのシステム目的の設定を管理する便利なモジュール
usage 非推奨です、'syspurpose' を参照してください
version バージョン情報を表示します
ちなみにproxy環境の場合、
/etc/environment
などでプロキシの変数が効かないことがあり、
その場合は/etc/rhsm.rhsm.conf
にproxyの情報をいれる必要があります。
外部接続できる場合
RHEL7での確認。OS上からそのまま登録・適用できます。
ターミナルコピペゆるちて
[root@host01 /]#
[root@host01 /]# subscription-manager register #SCA有効化のの場合、ここで完了
登録中: subscription.rhsm.redhat.com:443/subscription
ユーザー名: dango
パスワード:
このシステムは、次の ID で登録されました: 943908a1-d1bf-4d75-b7c6-f2513122fbe4
登録したシステム名: host01
[root@host01 /]#
[root@host01 /]# subscription-manager list
+-------------------------------------------+
インストール済み製品のステータス
+-------------------------------------------+
製品名: Red Hat Enterprise Linux Server
製品 ID: 69
バージョン: 7.5
アーキテクチャー: x86_64
状態: サブスクライブしていません
状態の詳細: 有効なサブスクリプションでサポートされていません。
開始:
終了:
[root@host01 /]#
[root@host01 /]# subscription-manager identity #システムID,サブスクが紐づくアカウントの情報表示
システム ID: 943908a1-d1bf-4d75-b7c6-f2513122fbe4
名前: host01
組織名: 18xxxxxx
組織 ID: 18xxxxxx
[root@host01 /]#
[root@host01 /]# subscription-manager list --available
+-------------------------------------------+
利用可能なサブスクリプション
+-------------------------------------------+
サブスクリプション名: 30 Day Red Hat Enterprise Linux Server Self-Supported Evaluation
提供: Red Hat Beta
Oracle Java (for RHEL Server)
Red Hat Enterprise Linux Server
Red Hat Ansible Engine
Red Hat Container Images Beta
Red Hat Enterprise Linux Atomic Host Beta
Red Hat Enterprise Linux Atomic Host
Red Hat Container Images
SKU: RH00065
契約: 11833975
プール ID: 8a85f99a67cdc3e701682adea40e3295
管理の提供: いいえ
数量: 1
推奨: 1
サービスレベル: Self-Support
サービスタイプ: L1-L3
サブスクリプションタイプ: Instance Based
終了: 2019年02月06日
システムタイプ: 物理
[root@host01 /]#
[root@host01 /]# subscription-manager subscribe --pool=8a85f99a67cdc3e701682adea40e3295
サブスクリプションが正しく割り当てられました: 30 Day Red Hat Enterprise Linux Server Self-Supported Evaluation
[root@host01 /]#
[root@host01 /]# subscription-manager list
+-------------------------------------------+
インストール済み製品のステータス
+-------------------------------------------+
製品名: Red Hat Enterprise Linux Server
製品 ID: 69
バージョン: 7.5
アーキテクチャー: x86_64
状態: サブスクライブ済み
状態の詳細:
開始: 2019年01月07日
終了: 2019年02月06日
[root@host01 /]#
ユーザー名・パスワードは管理ポータルのものを使用します。
ここでは評価版のライセンスを適用しています。
# subscription-manager list --available
で利用できるサブスクリプションのプールIDを確認し、
# subscription-manager subscribe --pool=xxxxxxxxxx
で適用します。
上記完了後、WEBポータルにも反映されます。
https://access.redhat.com/management/
オフラインの場合
はじめに外部に繋がる端末のWEB上でいろいろやる必要があります。
RHEL7での確認
①システム登録
https://access.redhat.com/management/
にアクセスし、[システム]タブの「システムプロファイルの新規作成」
から適用するシステムを手動で登録します。
どうせ繋がらないのでなんでもいいのですが、システム名やバージョンなどを入力します。
②サブスクリプションのアタッチ
登録したシステムの[サブスクリプション]タブから、
「サブスクリプションのアタッチ」
をクリックします。
適用可能なサブスクリプションが出てくるのでアタッチします。
③証明書のダウンロード
適用後、横に「証明書のダウンロード」が出てくるのでクリックしてダウンロードします。
(zipでダウンロードされます)
④適用
ダウンロードしたzipを解凍し、中にあるpemファイルを適用するコンピューター上に配置します。
/tmpに配置したとして、以下コマンドを実行します。
# subscription-manager import --certificate=/tmp/Name_Of_Downloaded_Entitlement_Cert.pem
証明書 Name_Of_Downloaded_Entitlement_Cert.pem は正常にインポートされました
と表示されればOK 。
CSA有効化後の場合 !(2024/12 追記)!
RHEL9(2025時点)では、そもそも上記のような方法を取ること自体ができなくなっているようです。
subscription-manager importコマンドのhelpにも以下の記載がありました。
Deprecated, this command will be removed from the future major releases. This command is no-op in simple content access mode. Import certificates which were provided outside of the tool
確認
# subscription-manager list
+-------------------------------------------+
インストール済み製品のステータス
+-------------------------------------------+
製品名: Red Hat Enterprise Linux Server
製品 ID: 69
バージョン: 7.8
アーキテクチャー: x86_64
状態: 不明
状態の詳細:
開始:
終了:
オフラインなのでステータス情報はみえませんが、これでyum実行できるようになります。
以上オオン。