Skip to content

antony@notes:~/misc$ cat "離線安裝-RedHat-Satelite-Server.md"

離線安裝 RedHat Satelite Server

2024-09-23· misc

離線安裝 RedHat Satelite Server

Chapter 1. 準備安裝環境

1.1. 系統要求

  • x86_64 架構
  • 最新版本的 Red Hat Enterprise Linux 8
  • 至少 4 Core 2.0 GHz CPU
  • Satellite Server 至少需要 20 GB RAM 才能運作。 此外,還建議使用至少 4 GB RAM 的 swap space 。 在 RAM 小於最小值的情況下執行的 Satellite 可能無法正常運作。
  • 唯一的主機名稱,可包含小寫字母、數字、點 (.) 和連字線 (-)
  • 目前的 Red Hat Satellite 訂閱
  • 管理使用者 (root) 存取權限
  • 使用完全定義的網域名稱 (FQDN) 進行完全正向和反向 DNS 解析

1.2. 儲存要求

image

1.3. 支援的作業系統

image

Chapter 2. 開始安裝 Satellite Server

2.1. 下載 binary DVD images

  1. 連到 Red Hat Customer Portal 並登入.
  2. 點選 DOWNLOADS.
  3. 選擇 Red Hat Enterprise Linux.
  4. 確保使用正確的產品和版本。
    • Product Variant 設定為 Red Hat Enterprise Linux for x86_64.
    • Version is set to the latest minor version of the product you plan to use as the base operating system.
    • Architecture is set to the 64 bit version.
  5. Product Software tab 上, 下載 Binary DVD image for the latest Red Hat Enterprise Linux for x86_64 version.
  6. 再次點選 DOWNLOADS 並選擇 Red Hat Satellite.
  7. 確保使用正確的產品和版本。
    • Product Variant 設定為 Red Hat Satellite.
    • Version is set to the latest minor version of the product you plan to use.
  8. Product Software tab 上, 下載最新版 Red Hat Satellite 的 Binary DVD image.
  9. 將 RHEL 8 的 ISO 檔複製到 Satellite OS 上的 /var/tmp 或其他可存取的儲存裝置。
    $ scp localfile username@hostname:remotefile

2.2. 設定 RHEL 8 使用離線的套件儲存庫

  1. 建立一個目錄,作為與基本作業系統版本對應的 ISO 檔案的 mount point。

    $ mkdir /media/rhel8
  2. 將 Red Hat Enterprise Linux 的 ISO 映像掛載到 mount point。

    $ mount -o loop rhel8-DVD.iso /media/rhel8
  3. 複製 ISO 檔案的儲存庫資料並變更權限,請輸入:

    $ cp /media/rhel8/media.repo /etc/yum.repos.d/rhel8.repo
    $ chmod u+w /etc/yum.repos.d/rhel8.repo
  4. 編輯儲存庫資料檔,並新增 baseurl 指令。

    $ vim /etc/yum.repos.d/rhel8.repo

    內容如下 :

    [RHEL8-BaseOS]
    name=Red Hat Enterprise Linux BaseOS
    mediaid=None
    metadata_expire=-1
    gpgcheck=0
    cost=500
    baseurl=file:///media/rhel8/BaseOS/
    
    [RHEL8-AppStream]
    name=Red Hat Enterprise Linux Appstream
    mediaid=None
    metadata_expire=-1
    gpgcheck=0
    cost=500
    baseurl=file:///media/rhel8/AppStream/
  5. 驗證儲存庫是否已設定。

    $ yum repolist
  6. 建立一個目錄,作為 Satellite Server ISO 檔案的 mount point。

    $ mkdir /media/sat6
  7. 將 Satellite Server 的 ISO image 掛載到 mount point。

    $ mount -o loop sat6-DVD.iso /media/sat6

2.3. 從離線套件儲存庫安裝 Satellite 套件

  1. 確保已掛載 Red Hat Enterprise Linux Server 和 Red Hat Satellite 的 ISO image

    $ findmnt -t iso9660

    執行結果應跟以下類似 :

    TARGET       SOURCE     FSTYPE  OPTIONS
    /media/rhel8 /dev/loop0 iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048
    /media/sat6  /dev/loop1 iso9660 ro,relatime,nojoliet,check=s,map=n,blocksize=2048
  2. 匯入 Red Hat GPG 金鑰

    $ rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
  3. 確保基本作業系統是最新的

    $ dnf update
  4. 變更當前目錄至掛載 Satellite ISO 的目錄:

    $ cd /media/sat6/
  5. 在掛載的目錄中執行安裝腳本:

    $ ./install_packages

    執行結果如下 :

    This script will install the satellite packages on the current machine.
       - Ensuring we are in an expected directory.
       - Copying installation files.
       - Creating Satellite Repository File
       - Creating Maintenance Repository File
       - Checking to see if Satellite is already installed.
       - Importing the gpg key.
    Problems in request:
    Modular dependency problems with Defaults:
    
     Problem: module satellite:el8:61520240903125913:30aa3ae0.x86_64 from Satellite-local requires module(postgresql:12), but none of the providers can be installed
      - module postgresql:10:8090020240213200157:a75119d5.x86_64 from RHEL8-AppStream conflicts with module(postgresql:12) provided by postgresql:12:8090020240209130909:a75119d5.x86_64 from RHEL8-AppStream
      - module postgresql:12:8090020240209130909:a75119d5.x86_64 from RHEL8-AppStream conflicts with module(postgresql:10) provided by postgresql:10:8090020240213200157:a75119d5.x86_64 from RHEL8-AppStream
      - conflicting requests
       - Installation repository will remain configured for future package installs.
       - Installation media can now be safely unmounted.
    
    Install is complete. Please run satellite-installer --scenario satellite

    如果您已成功安裝 Satellite 套件,則會顯示下列訊息:

    Install is complete. Please run satellite-installer --scenario satellite

:::info

Note

The script contains a command that enables the satellite:el8 module. Enablement of the module satellite:el8 warns about a conflict with postgresql:10 and ruby:2.5 as these modules are set to the default module versions on Red Hat Enterprise Linux 8. The module satellite:el8 has a dependency for the modules postgresql:12 and ruby:2.7 that will be enabled with the satellite:el8 module. These warnings do not cause installation process failure, hence can be ignored safely.

:::

2.4. Synchronizing the system clock with chronyd

為了將時間漂移的影響降至最低,您必須將要安裝 Satellite Server 的基本作業系統上的系統時鐘與網路時間協定 (NTP) 伺服器同步化。 如果基本作業系統時鐘設定不正確,證書驗證可能會失敗。

  1. 安裝 chrony 套件
    $ dnf install chrony
  2. Start and enable the chronyd service:
    $ systemctl enable --now chronyd

2.5. 設定 Satellite Server

  1. 輸入下列命令,並加上您要使用的其他選項:

    $ satellite-installer --scenario satellite \
    --foreman-initial-organization "My_Organization" \
    --foreman-initial-location "My_Location" \
    --foreman-initial-admin-username admin_user_name \
    --foreman-initial-admin-password admin_password

執行成功的結果如下

2024-09-23 14:28:24 [NOTICE] [root] Loading installer configuration. This will take some time.
2024-09-23 14:28:30 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2024-09-23 14:28:30 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2024-09-23 14:31:01 [NOTICE] [configure] Starting system configuration.
2024-09-23 14:31:32 [NOTICE] [configure] 250 configuration steps out of 1613 steps complete.
2024-09-23 14:32:04 [NOTICE] [configure] 500 configuration steps out of 1614 steps complete.
2024-09-23 14:32:18 [NOTICE] [configure] 750 configuration steps out of 1616 steps complete.
2024-09-23 14:33:16 [NOTICE] [configure] 1000 configuration steps out of 1641 steps complete.
2024-09-23 14:33:38 [NOTICE] [configure] 1250 configuration steps out of 1643 steps complete.
2024-09-23 14:38:39 [NOTICE] [configure] 1500 configuration steps out of 1643 steps complete.
2024-09-23 14:43:01 [NOTICE] [configure] System configuration has finished.
  Success!
  * Satellite is running at https://satellite.example.com
      Initial credentials are admin / rancher

  * To install an additional Capsule on separate machine continue by running:

      capsule-certs-generate --foreman-proxy-fqdn "$CAPSULE" --certs-tar "/root/$CAPSULE-certs.tar"
  * Capsule is running at https://satellite.example.com:9090

The full log is at /var/log/foreman-installer/satellite.log
Package versions are being locked.

The script displays its progress and writes logs to /var/log/foreman-installer/satellite.log.

  1. Unmount the ISO images:

    $ umount /media/sat6
    $ umount /media/rhel8

2.6. Disabling subscription connection

在離線的 Satellite Server 上停用訂閱連線,以避免連線至 Red Hat Portal。 這也會讓您無法刷新 manifest (清單) 和更新 upstream entitlements (上游權限)。

  • 在 Satellite Server 上輸入以下指令:

    $ hammer settings set --name subscription_connection_enabled --value false

    執行結果如下 :

    Setting [subscription_connection_enabled] updated to [false].

2.7. Exporting a Subscription Manifest from the Customer Portal

  1. Open https://access.redhat.com/ in your browser and log in to your Red Hat account.
  2. Navigate to Subscriptions, which is in the upper-left corner of the Customer Portal page.
  3. Click the Subscription Allocations tab.
  4. From the Name column, select the name of the subscription allocation you want to export.
  5. On the Details pane, click Export Manifest to download the subscription manifest file.

2.8. Importing a Red Hat subscription manifest into Satellite Server

  1. 將 Red Hat subscription manifest (訂閱清單) 檔案從本機複製到 Satellite Server:

    $ scp ~/manifest_file.zip root@satellite.example.com:~/
  2. root 使用者身份登入 Satellite Server,並匯入 Red Hat 訂閱清單檔案:

    $ hammer subscription upload \
    --file ~/manifest_file.zip \
    --organization "SUSELab"

Chapter 3. Importing content

3.1. Products and repositories in Satellite

Red Hat content 與 Satellite 中的自訂 content 有相似之處:

  • 產品與它的儲存庫之間的關係相同,儲存庫仍需要同步。
  • 自訂產品需要訂閱才能讓主機存取,與 Red Hat 產品的訂閱相似。 Satellite 會為您建立的每個自訂產品建立訂閱。

Red Hat 的 content 已經被組織成產品。 例如,Red Hat Enterprise Linux Server 是 Satellite 中的一個產品。 該 Product 的資源庫包含不同的版本、架構和附加元件。 對於 Red Hat repositories (套件庫),產品會在啟用套件庫後自動建立。

其他 content 可以隨您的喜好組織成自訂產品。 例如,您可以建立 EPEL (Extra Packages for Enterprise Linux) 產品,並將「EPEL 7 x86_64」套件庫加入其中。

3.2. Adding a default HTTP proxy to Satellite

如果您的網路使用 HTTP proxy,可以設定 Satellite Server 使用 HTTP 代理來處理對 Red Hat Content Delivery Network (CDN) 或其他 context 來源的請求。 盡可能使用 FQDN 而非 IP 位址,以避免因網路變更而失去連線。

  1. 確認沒有設定 http_proxyhttps_proxyno_proxy 變數。

    $ unset http_proxy
    $ unset https_proxy
    $ unset no_proxy
  2. 新增 HTTP proxy entry 到 Satellite:

    $ hammer http-proxy create --name=myproxy \
    --url http://myproxy.example.com:8080  \
    --username=proxy_username \
    --password=proxy_password

    執行結果如下

    Http proxy created.
  3. 設定 Satellite 預設使用此 HTTP Proxy:

    $ hammer settings set --name=content_default_http_proxy --value=myproxy

    執行結果如下

    Setting [content_default_http_proxy] updated to [myproxy].

3.3. Enabling Red Hat repositories

若要選擇要同步化的儲存庫,您必須先辨識包含儲存庫的產品,然後根據相關的發行版本和基本架構啟用該儲存庫。

適用於 Red Hat Enterprise Linux 8 主機

若要設定 Red Hat Enterprise Linux 8 主機,需要以下兩個套件庫。

  • Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
  • Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

適用於 Red Hat Enterprise Linux 7 主機

若要設定 Red Hat Enterprise Linux 7 主機,您需要 Red Hat Enterprise Linux 7 Server (RPMs) 套件庫。

將 Red Hat Enterprise Linux 作業系統發佈版本與 7Server 套件庫或 7.X 套件庫相關聯的差別在於,7Server 套件庫包含所有最新的更新,而 Red Hat Enterprise Linux 7.X 套件庫在下一個次要版本發佈之後就不再獲得更新。 請注意,Kickstart 套件庫只有 minor (次要)版本。

  1. 若要搜尋您的產品,請輸入下列指令:

    $ hammer product list --organization "My_Organization"

Ref