antony@notes:~/suse$ cat "Use-SUSE-Liberty-Linux-to-update-Red-Hat-Enterprise-Linux-9.md"
Use SUSE Liberty Linux to update Red Hat Enterprise Linux 9
Use SUSE Liberty Linux to update Red Hat Enterprise Linux 9
Preface
本篇文章會採取 Step by Step 和 Screenshot 的方式介紹,
- 如何透過 SUSE Liberty Linux 註冊和更新 Red Hat Enterprise Linux 9
可以透過點擊展開以下目錄,選擇想看的內容,跳轉至特定章節
:::warning
:::spoiler 文章目錄
[TOC]
:::
Introduction
SUSE Liberty Linux 是一款適用於混合 Linux 環境的技術和解決方案。使用 SUSE Liberty Linux 訂閱,可以註冊並接收 Red Hat Enterprise Linux 和 SUSE Linux Enterprise Server 的更新。
An optional High Availability extension is also available.
:::info
Note: CentOS Stream 沒有支援
:::
- Red Hat Enterprise Linux 9 會透過 SUSE 的 Repository Mirroring Tool ( RMT ) Server 註冊。
- 可以把 RMT Server 認為它是 SUSE Customer Center 的代理系統。
- RMT Server 會向 SUSE Custom Center ( 客戶中心 ) 註冊和 Mirror SUSE Liberty Linux 的套件清單,而在網路中的其他系統則向 RMT Server 註冊,並直接從它那裡接收 Packgae ( 套件 )。
Requirements
- 有 SUSE Liberty Linux 的 subscription ( 訂閱 )
- 有 SUSE Customer Center 的帳號
- 要註冊的系統已經是最新的版本。因為 SUSE Liberty Linux 僅支援每個 RHEL 版本的最新發行版本。
- SUSE Linux Enterprise Server (SLES) 15 與要註冊的系統安裝和運行在同一網絡中。可以使用 SUSE Liberty Linux 訂閱來註冊 SLES。
- SUSE Linux Enterprise Server 有足夠的儲存空間可供 repository mirroring ( 鏡像儲存庫 )。下載的套件存放在
/usr/share/rmt/public/repo,這是指向/var/lib/rmt/public/repo/的 symbolic link ( 軟連結 )。所需的儲存空間取決於 mirror ( 鏡像 ) 的儲存庫數量。 - 我們建議至少為所有已啟用版本庫總大小的 1.5 倍。截至最新發布日期,SUSE Liberty Linux 9 版本庫的大小約為 95 GB,如果需要 Source ( 源代碼 ) 和 Debug 版本庫,還需要額外的 185 GB。注意,這些 Package 儲存庫會隨著時間的推移而大幅增長。
Configuring the RMT server
REQUIREMENTS
- 已經裝好且是最新版的 SUSE Linux Enterprise Server 15。
- 有一個 SUSE Customer Center 的帳號和 organization credentials ( 組織憑證 )。
Step1: 在 SUSE Linux Enterprise Server 15 上安裝 RMT Server
$ sudo zypper in -y rmt-serverStep2: 在 YaST2 中啟動 rmt module
$ sudo yast2 rmtStep3: 輸入 Organization Credentials ( 組織憑證 ),然後按 Next。
- 帳號和密碼會放在 SUSE Customer Center 的 My Organization ( 選一個 ) -> Users -> Organization Credentials

Step4: 為新的 MariaDB 資料庫使用者輸入 Database Credentials ( 資料庫憑證 ),然後按 Next之後,新的使用者會被創建。
- 使用者帳號 :
rmt - 使用者密碼 :
rancher

Step5: 如果 MariaDB 的 root 使用者已經設定密碼,請輸入密碼,然後按下「OK」。
如果 MariaDB 的 root 使用者沒有設定密碼,請輸入新密碼,並確認新密碼,然後按下「OK」。
- New MariaDB root Password:
rancher - Confirm Password:
rancher

Step6: 輸入 SSL 憑證的 Common Name,然後按 Next。
- Common Name:
rmt-server.example.com - Common Name 是伺服器的 FQDN ( 完整網域名稱 )。

Step7: 輸入並確認 CA 私鑰的密碼,然後按「OK」。
- Password:
rancher - Confirm Password:
rancher

Step8: 如果有啟用 firewalld,要打開 HTTP 和 HTTPS 的防火牆 ports,沒有的話選 “Next”。

Step9: YaST2 會顯示 RMT Service 的狀態,按 “Next”。

Step10: 檢查 RMT 設定檔的資訊有無錯誤,然後選擇 “Finish” 關閉 YaST2。

Mirroring SUSE Liberty Linux repositories with RMT
REQUIREMENTS
- 上一個章節「Configuring the RMT server」已完成。
- RMT Server 有足夠的儲存空間可以 Mirror 儲存庫。
- organization credentials ( 組織憑證 ) 已正確顯示在
/etc/rmt.conf檔案中。 - 在 SUSE Custom Center 已啟用 SUSE Liberty Linux 訂閱。
Step1: 在 RMT Server 上,更新可以用的 Product ( 產品 ) 和 Repository ( 儲存庫 )的 metadata。
$ sudo rmt-cli sync- 此步驟會需要網路,到 SCC 上下載資料,沒有網路的話不會噴錯,所以要特別注意
- Offline 或其他的 mirror 方法連結 - SUSE Docs
螢幕輸出 :
I, [2023-08-14T13:55:12.070503 #7894] INFO -- : Downloading data from SCC
I, [2023-08-14T13:55:12.070633 #7894] INFO -- : Updating products
I, [2023-08-14T13:56:23.357512 #7894] INFO -- : Updating repositories
I, [2023-08-14T13:56:34.686989 #7894] INFO -- : Updating subscriptions同步也會由 rmt-server-sync.timer 自動執行。可以執行以下命令檢查狀態和下次排程同步時間:
$ sudo systemctl status rmt-server-sync.timer螢幕輸出 :
● rmt-server-sync.timer - RMT Sync timer
Loaded: loaded (/usr/lib/systemd/system/rmt-server-sync.timer; enabled; vendor preset: disabled)
Active: active (waiting) since Mon 2023-08-14 13:35:48 CST; 23min ago
Trigger: Tue 2023-08-15 06:39:14 CST; 16h left
Triggers: ● rmt-server-sync.service
Aug 14 13:35:48 rmt-server systemd[1]: Started RMT Sync timer.
Step2: enable SUSE Liberty Linux using the product ID 2538
$ sudo rmt-cli product enable 2538- rhel8 的 product ID 是
1921, High Availability extension 是1922
螢幕輸出 :
Found product by target 2538: SUSE Liberty Linux 9 x86_64.
Enabling SUSE Liberty Linux 9 x86_64:
SUSE Liberty Linux 9 x86_64:
Enabled repository SLL-9-Updates.
Enabled repository SLL-AS-9-Updates.
Enabled repository SLL-CB-9-Updates.如果在執行完以上命令後有遇到以下錯誤訊息
Product by ID 2538 not found. Product 2538 could not be found and was not enabled.
- 請確定註冊 RMT Server 的組織是否有 SUSE Liberty Linux 的 subscription
- 如果有的話,請執行以下命令
sudo systemctl restart rmt-server-sync.timer && sudo rmt-cli sync,讓它重新 Update 資料。
Step3: If your subscription includes the High Availability extension, enable the extension using the product ID 2539
$ rmt-cli product enable 2539Step4: If you also need the Source or Debug repositories, find and enable them with the following commands
$ sudo rmt-cli repo list --all | grep SLL-螢幕輸出 :
| 5965 | SLL-9-Debug-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5964 | SLL-9-Source-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5963 | SLL-9-Updates for x86_64 | Mandatory | Mirror |
| 5968 | SLL-AS-9-Debug-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5967 | SLL-AS-9-Source-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5966 | SLL-AS-9-Updates for x86_64 | Mandatory | Mirror |
| 5971 | SLL-CB-9-Debug-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5970 | SLL-CB-9-Source-Updates for x86_64 | Not Mandatory | Don't Mirror |
| 5969 | SLL-CB-9-Updates for x86_64 | Mandatory | Mirror |Enable Source or Debug repositories
$ sudo rmt-cli repo enable REPO_IDStep5: Start package mirroring for the enabled repositories
$ sudo rmt-cli mirror- 大概會需要 2 個小時
- 可用的儲存空間至少要有 150 GiB
- 如果網路不好可能會需要重新執行幾次這行命令
- 最後正確的螢幕輸出如下
:::spoiler 螢幕輸出 :
I, [2023-08-15T15:27:03.785553 #1558] INFO -- : Mirroring SUSE Manager product tree to /usr/share/rmt/public/suma/ I, [2023-08-15T15:27:35.831000 #1558] INFO -- : ↓ product_tree.json I, [2023-08-15T15:27:35.893025 #1558] INFO -- : Mirroring repository SLL-9-Updates to /usr/share/rmt/public/repo/SUSE/Updates/SLL/9/x86_64/update/ I, [2023-08-15T15:27:37.793159 #1558] INFO -- : → repomd.xml I, [2023-08-15T15:27:38.678644 #1558] INFO -- : → repomd.xml.asc I, [2023-08-15T15:27:39.587719 #1558] INFO -- : → repomd.xml.key I, [2023-08-15T15:27:41.667986 #1558] INFO -- : → primary.xml.gz I, [2023-08-15T15:27:41.791883 #1558] INFO -- : → filelists.xml.gz I, [2023-08-15T15:27:41.875650 #1558] INFO -- : → other.xml.gz I, [2023-08-15T15:27:41.892160 #1558] INFO -- : → comps.xml I, [2023-08-15T15:27:41.902849 #1558] INFO -- : → comps.xml.gz I, [2023-08-15T15:27:41.926459 #1558] INFO -- : → updateinfo.xml.gz I, [2023-08-15T15:27:55.762715 #1558] INFO -- : Mirroring repository SLL-AS-9-Updates to /usr/share/rmt/public/repo/SUSE/Updates/SLL-AS/9/x86_64/update/ I, [2023-08-15T15:27:57.606671 #1558] INFO -- : → repomd.xml I, [2023-08-15T15:27:58.538643 #1558] INFO -- : → repomd.xml.asc I, [2023-08-15T15:27:59.442143 #1558] INFO -- : → repomd.xml.key I, [2023-08-15T15:28:01.309343 #1558] INFO -- : → primary.xml.gz I, [2023-08-15T15:28:01.426422 #1558] INFO -- : → filelists.xml.gz I, [2023-08-15T15:28:01.452798 #1558] INFO -- : → other.xml.gz I, [2023-08-15T15:28:01.476978 #1558] INFO -- : → comps.xml I, [2023-08-15T15:28:01.490309 #1558] INFO -- : → comps.xml.gz I, [2023-08-15T15:28:01.492242 #1558] INFO -- : → modules.yaml.gz I, [2023-08-15T15:28:01.501528 #1558] INFO -- : → updateinfo.xml.gz I, [2023-08-15T15:28:15.805530 #1558] INFO -- : Mirroring repository SLL-CB-9-Updates to /usr/share/rmt/public/repo/SUSE/Updates/SLL-CB/9/x86_64/update/ I, [2023-08-15T15:28:17.624244 #1558] INFO -- : ↓ repomd.xml I, [2023-08-15T15:28:18.523775 #1558] INFO -- : ↓ repomd.xml.asc I, [2023-08-15T15:28:19.421876 #1558] INFO -- : ↓ repomd.xml.key I, [2023-08-15T15:28:20.489766 #1558] INFO -- : ↓ primary.xml.gz I, [2023-08-15T15:28:20.495701 #1558] INFO -- : ↓ updateinfo.xml.gz I, [2023-08-15T15:28:20.778624 #1558] INFO -- : ↓ other.xml.gz I, [2023-08-15T15:28:20.909967 #1558] INFO -- : ↓ filelists.xml.gz I, [2023-08-15T15:33:32.340497 #1558] INFO -- : ↓ dotnet-sdk-6.0-source-built-artifacts-6.0.109-3.el9.x86_64.rpm I, [2023-08-15T15:33:33.374851 #1558] INFO -- : Mirroring complete.
:::
Registering RHEL with RMT
:::info Note: CentOS Stream is not supported. :::
REQUIREMENTS
- 已完成「Configuring the RMT server」章節。
- 已完成「Mirroring SUSE Liberty Linux repositories with RMT」章節。
- RMT Server 正在執行 rmt-server 版本 2.10 或更新版本。
- 要註冊的系統可以 Access RMT Server。
- 要註冊的系統正在執行 RHEL 9 的最新發行版本。
- 在 SUSE Custom Center 已啟用 SUSE Liberty Linux 訂閱。
- 準備一個沒有訂閱過 Red Hat subscription services 的 Red Hat Enterprise Linux。
Step1: 在 RHEL 系統上, 下載 rmt-client-setup-res script
$ curl http://rmt-server.example.com/tools/rmt-client-setup-res --output rmt-client-setup-res- RMT Server 的 FQDN 需要自行設定
Step2: 使用 RMT Server 的 URL 作為參數並執行 rmt-client-setup-res 腳本
$ sudo sh rmt-client-setup-res https://rmt-server.example.com- RMT Server 的 FQDN 需要自行設定
螢幕輸出 :
...以上省略 Successfully registered system
如果在執行完以上命令後有遇到以下錯誤訊息
Your Registration Proxy server doesn't support this function. Please update it and try again.請執行以下命令檢視 log 檔
$ cat /var/log/nginx/rmt_https_error.log查看是否有類似以下錯誤訊息
2023/08/16 17:48:10 [error] 1309#1309: *29 "/usr/share/rmt/public/repo/keys/index.html" is not found (2: No such file or directory), client: cidr, server: rmt, request: "GET /repo/keys/ HTTP/1.1", host: "rmt_server_domain"如果是的話,請執行以下命令
$ sudo chown '_rmt':"nginx" /usr/share/rmt/config/secrets.yml.key再到 Client 端,重新註冊一次應該就會成功了。
Step3: 確認已安裝的 product 是否有註冊成功
$ sudo SUSEConnect --status-text螢幕輸出 :
------------------------------------------
SUSE Liberty Linux release file
(SLL/9/x86_64)
Registered
------------------------------------------Step4: 確認可用的 Repositories
$ sudo dnf repolist螢幕輸出 :
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
repo id repo name
SUSE_Liberty_Linux_x86_64:SLL-9-Updates SLL-9-Updates
SUSE_Liberty_Linux_x86_64:SLL-AS-9-Updates SLL-AS-9-Updates
SUSE_Liberty_Linux_x86_64:SLL-CB-9-Updates SLL-CB-9-UpdatesYou should see
SLL-9-Updates,SLL-AS-9-Updates, andSLL-CB-9-Updates.
If your subscription includes the High Availability extension, activate it with the following command:
$ SUSEConnect -p SLL-HA/9/x86_64To check whether the extension is available, run the
SUSEConnect --list-extensionscommand.
Step5: 執行以下更新命令,確認可以順利更新
$ sudo dnf update -y螢幕輸出 :
...以上省略
Complete!