vagrantでrhel8を試してみる

Shimer-System 開発関連
スポンサーリンク

vagrantでrhel8を試そうと思ったら、dnf(yumの新しいやつ)でリポジトリが見つからなくてはまったので記録を残しておきます。特に開発ライセンス(1年間無料で使えるやつ)のサブスクリプションのやり方なんてすぐ忘れてしまいそうです・・・

rhel8を起動するところまでの手順

ターミナルで作業用のディレクトリに移動して実行してください。

$ vagrant box add generic/rhel8  https://app.vagrantup.com/generic/boxes/rhel8
$ vagrant init generic/rhel8
$ vagrant plugin install vagrant-vbguest

Vagrantファイルが出力されるので必要であればprivate_networkやprovisionの設定をします。

Vagrant.configure("2") do |config|
  config.vm.box = "generic/rhel8"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.provision :shell, :path => "provision.sh"
end

ターミナルでvagrantを起動します。

$ vagrant up

開発者用ライセンスを作成

1.開発者として登録してrhelのダウンロード画面を開きます。

2.アクティベーションキーを作成します。

サービスレベル:self、自動アタッチ有効でいいと思います。

vagrantのrhelをアクティベーション

1.コンソールからrhelにsshで接続して認証します。

$ vagrant ssh
$ sudo -i
$ subscription-manager register

※何回もboxの作り直しが発生しそうな場合は、プロビジョニングに組み込んでおくのがオススメです。その場合は「subscription-manager register –username ユーザ名 –password パスワード」を使います。

2020-06-09追記
プロビジョニングに組み込む場合、サブスクリプションの許可を待たせるのに「subscription-manager attach –auto」の追加が必要でした。

2.管理画面でライセンスを割り当てます

詳細を開いてサブスクリプションタブから開発用のサブスクリプションを設定しておわりです。

おまけ

サブスクリプションしないでdnfやyumやらをすると↓のエラーでます。

[vagrant@rhel8 yum.repos.d]$ yum search httpd
Failed to set locale, defaulting to C.UTF-8
2020-05-27 10:49:14,935 [ERROR] yum:3020:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated

リポジトリの一覧を出そうとしてもエラー

[root@rhel8 ~]# subscription-manager repos --list-enabled
You are attempting to use a locale that is not installed.
This system has no repositories available through subscriptions.
タイトルとURLをコピーしました