2.7. リモートリポジトリーの作成

この手順は、DVD ISO イメージから抽出したコンテンツを含むリモートレポジトリーを使用する、ネットワークベースのインストールを作成する手順を説明します。インストールソースには、HTTP、または HTTPS でアクセスします。

前提条件

  • Red Hat Enterprise Linux 9 インストール DVD/ISO イメージがある。
  • Red Hat Enterprise Linux を実行しているサーバーが複数ある。

2.7.1. RHEL への Apache のインストール

この手順では、Red Hat Enterprise Linux 9 に Apache をインストールする方法を説明します。

前提条件

  • Apache Web サーバーを使用してリポジトリーにアクセスできる。

手順

  1. httpd パッケージのインストール

    # dnf install httpd
  2. 次に、Apache Web サーバーを有効にします。再起動後に、次のコマンドにより Web サーバーが起動します。

    # systemctl enable httpd
    # systemctl start httpd
  3. 所有している Web サイトファイルを挿入します。

    # echo Apache on RHEL {ProductNumber} > /var/www/html/index.html
  4. ファイアウォールを更新します。

    # firewall-cmd --add-service=http --permanent
    # firewall-cmd --add-service=http
  5. Web サイトにアクセスします。

    http://<the-apache-ip-address>
    
    http://<the-apache-hostname>

2.7.2. リモートリポジトリーの作成

複数の Red Hat Enterprise Linux サーバーは、ネットワーク上にある単一の Red Hat Enterprise Linux リポジトリーにアクセスできます。これには web サーバーが必要になりますが、おそらく Apache がこれになります。

前提条件

  • Red Hat Enterprise Linux 9 インストール DVD/ISO イメージがある。
  • Red Hat Enterprise Linux を実行しているサーバーが複数ある。

手順

  1. ダウンロードした DVD のコンテンツをマウントしてコピーします。

    mkdir /mnt/rhel{ProductNumber}
    mount -o loop,ro rhel-{ProductNumber}-x86_64-dvd.iso /mnt/rhel{ProductNumber}/
    cp -r /mnt/rhel{ProductNumber}/ /var/www/html/
    umount  /mnt/rhel{ProductNumber}

    次の手順は、Apache がインストールされているサーバーではなく、クライアント側で実行します。

  2. BaseOS リポジトリーおよび AppStream リポジトリー両方のリポジトリーファイルを作成します。

    vi /etc/yum.repos.d/rhel_http_repo.repo
    
    [BaseOS_repo_http]
    name=RHEL_9_x86_64_HTTP BaseOS
    baseurl="http://myhost/rhel9/BaseOS"
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    
    [AppStream_repo_http]
    name=RHEL_9_x86_64_HTTP AppStream
    baseurl="http://myhost/rhel9/AppStream"
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    
    [root@localhost ~]# dnf repolist
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Last metadata expiration check: 0:08:33 ago on Út 23. července 2019, 16:48:09 CEST.
    repo id                                                              repo name                                                                        status
    AppStream_repo_http                                                  RHEL_9_x86_64_HTTP AppStream                                                   4,672
    BaseOS_repo_http                                                     RHEL_9_x86_64_HTTP BaseOS                                                      1,658
    [root@localhost ~]#