8.2. RHEL for Edge イメージをインストールするための Web サーバーの設定
RHEL for Edge イメージのコンテンツを展開したら、HTTP を使用して RHEL インストーラーにイメージのコミット詳細を提供するための Web サーバーを設定します。
以下の例では、コンテナーを使用して Web サーバーを設定する手順を説明します。
前提条件
- システムに Podman をインストール済みである。How do I install Podman in RHEL を参照してください。
手順
以下の手順に従って、
nginx
設定ファイルを作成します。events { } http { server{ listen 8080; root /usr/share/nginx/html; } } pid /run/nginx.pid; daemon off;
以下の手順で Dockerfile を作成します。
FROM registry.access.redhat.com/ubi8/ubi RUN yum -y install nginx && yum clean all COPY kickstart.ks /usr/share/nginx/html/ COPY repo /usr/share/nginx/html/ COPY nginx /etc/nginx.conf EXPOSE 8080 CMD ["/usr/sbin/nginx", "-c", "/etc/nginx.conf"] ARG commit ADD ${commit} /usr/share/nginx/html/
詳細は以下のようになります。
kickstart.ks
は、RHEL for Edge イメージのキックスタートファイルの名前です。キックスタートファイルには、ディレクティブの情報が含まれています。後でイメージを管理しやすくするためにも、Greenboot チェックのチェックおよび設定を含むことが推奨されます。そのためには、以下の設定を含むようにキックスタートファイルを更新します。lang en_US.UTF-8 keyboard us timezone Etc/UTC --isUtc text zerombr clearpart --all --initlabel autopart reboot user --name=core --group=wheel sshkey --username=core "ssh-rsa AAAA3Nza…." ostreesetup --nogpg --osname=rhel --remote=edge --url=https://mirror.example.com/repo/ --ref=rhel/8/x86_64/edge %post cat << EOF > /etc/greenboot/check/required.d/check-dns.sh #!/bin/bash DNS_SERVER=$(grep nameserver /etc/resolv.conf | cut -f2 -d" ") COUNT=0 # check DNS server is available ping -c1 $DNS_SERVER while [ $? != '0' ] && [ $COUNT -lt 10 ]; do COUNT++ echo "Checking for DNS: Attempt $COUNT ." sleep 10 ping -c 1 $DNS_SERVER done EOF %end
任意の HTTP サービスで OSTree リポジトリーをホストできます。コンテナーを使用する例は、これを行う方法のオプションにすぎません。Dockerfile は次のタスクを実行します。
- 最新の Universal Base Image (UBI) の使用
- Web サーバー (nginx) をインストールします。
- キックスタートファイルのサーバーへの追加
- RHEL for Edge イメージのコミットのサーバーへの追加
Docker コンテナーをビルドします。
# podman build -t name-of-container-image --build-arg commit=uuid-commit.tar .
コンテナーを実行します。
# podman run --rm -d -p port:8080 localhost/name-of-container-image
これにより、サーバーがセットアップされ、
commit.tar
リポジトリーとキックスタートファイルを使用して、RHEL インストーラーを起動する準備が整いました。