Skip to content

antony@notes:~/suse$ cat "Registering-Oracle-Linux-Clients.md"

Registering Oracle Linux Clients

2024-01-15· suse ·SUSE Manager

Registering Oracle Linux Clients

Preface

本篇文章會介紹,如何成功將 Oracle Linux 7 Client 註冊到 SUSE Manager Server

可以透過點擊展開以下目錄,選擇想看的內容,跳轉至特定章節

:::warning

:::spoiler {state=“open”} 文章目錄

[TOC]

:::

1. 注意事項

  1. Oracle Linux 套件存儲庫 URL 可從 SUSE Custom Center 獲取
  2. Packages 和 Metadata 由 Oracle 提供而非 SUSE
  3. Oracle Linux base media 儲存庫可從 https://yum.oracle.com/ 免費下載
  4. 有關支持的產品,請參閱支持表和發行說明
  5. 目前不支援將 Unbreakable Linux Network (ULN) 資源庫與 SUSE Manager 直接同步。 必須使用用於 ULN 的 Oracle 本地發行版。
  6. Traditional clients 在 Oracle Linux 9 and 8 不適用,Oracle Linux 9 和 Oracle Linux 8 clients 只支援 Salt clients.

2. 在 SUSE Manager Server 新增 Software Channels

2.1. 系統要求

  • SUSE Manager Server 的 /var/spacewalk 目錄區剩餘空間量,必須有 150 G 以上的剩餘空間 ( 150 G 是最基礎的,如果可選的 Channels 都要加,保守估計 300 GB 以上)

2.2. 開始新增 Software Channels

以下 WebUI 和 CLI 的操作步驟選擇其中一種執行即可

2.2.1 使用 WebUI 操作步驟

  1. 勾選要加入的 Oracle Linux 7 x86_64
  2. 點擊 “Add product” ,然後等待同步完成

image

  1. 確認同步完成

在 Channels 欄位呈現綠勾勾的圖示,代表完成同步

image

2.3.2. 使用 CLI 操作步驟

連線至 SUSE Manager Server,並使用具有系統管理員權限的使用者帳號執行以下命令

$ sudo mgr-sync add channel oraclelinux7-x86_64 

輸入 SUSE Manager 管理員的帳號密碼

螢幕輸出 :

Please enter the credentials of SUSE Manager Administrator.
Login: sumaadmin
Password:
Channel 'oraclelinux7-x86_64' has already been added
Scheduling reposync for following channels:
- oraclelinux7-x86_64

2.3. Oracle Linux 在 SUSE Manager 上的資訊

下表是 Oracle Linux 每個版本對應的 Product 名稱 :

OS VersionProduct Name
Oracle Linux 9Oracle Linux 9 x86_64
Oracle Linux 8Oracle Linux 8 x86_64
Oracle Linux 7Oracle Linux 7 x86_64

2.4. 檢查是否同步成功

2.4.1. 檢視下載 oraclelinux7-x86_64 Channel 的 log 資訊

$ sudo tail -f /var/log/rhn/reposync/oraclelinux7-x86_64.log

螢幕輸出應該要看到類似以下資訊 :

2024/01/11 19:02:00 +08:00 Command: ['/usr/bin/spacewalk-repo-sync', '--channel', 'oraclelinux7-x86_64', '--type', 'yum', '--non-interactive']
2024/01/11 19:02:00 +08:00 Sync of channel started.
2024/01/11 19:02:17 +08:00
2024/01/11 19:02:17 +08:00   Importing comps file bbe5fe5a8fc06e1d34af14daa449db87f7fc3755-comps.xml.
2024/01/11 19:02:17 +08:00   Renaming non-standard filename bbe5fe5a8fc06e1d34af14daa449db87f7fc3755-comps.xml to comps.xml.
2024/01/11 19:02:17 +08:00 *** NOTE: Importing comps file for the channel 'oraclelinux7-x86_64'. Previous comps will be discarded.
2024/01/11 19:02:18 +08:00 Repo URL: https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/
2024/01/11 19:02:18 +08:00     Packages in repo:             26473
2024/01/11 19:03:37 +08:00     Packages already synced:       5236
2024/01/11 19:03:37 +08:00     Packages to sync:             21237
2024/01/11 19:03:39 +08:00     New packages to download:     21237
2024/01/11 19:03:39 +08:00   Downloading packages:
2024/01/11 19:03:43 +08:00     1/21237 : 389-ds-base-1.3.10.1-14.el7_8.x86_64.rpm
...中間省略
2024/01/11 21:03:33 +08:00     21235/21237 : zziplib-0.13.62-9.el7.i686.rpm
2024/01/11 21:03:33 +08:00     21236/21237 : zziplib-0.13.62-9.el7.x86_64.rpm
2024/01/11 21:03:33 +08:00     21237/21237 : zsh-5.0.2-34.el7_8.2.x86_64.rp
...中間省略
2024/01/11 21:03:33 +08:00 Importing packages started.
2024/01/11 21:03:33 +08:00
2024/01/11 21:03:33 +08:00   Importing packages to DB:
2024/01/11 21:04:05 +08:00   Package batch #5 of 1062 completed..
...中間省略
2024/01/11 22:24:43 +08:00 Add Patch ELBA-2019-2067
2024/01/11 22:24:43 +08:00     Syncing 3359 new patch(es) to channel.
2024/01/11 22:25:15 +08:00   Regenerating bootstrap repositories.
2024/01/11 22:25:16 +08:00 Sync completed
  • 下載完成後會在 log 檔中看到 Sync completed. 代表完成

2.4.2. 檢視下載 res-7-suse-manager-tools-x86_64-ol7 Channel 的 log 資訊

$ sudo tail -f /var/log/rhn/reposync/res-7-suse-manager-tools-x86_64-ol7.log

螢幕輸出應該要看到類似以下資訊 :

2024/01/11 22:25:58 +08:00 Command: ['/usr/bin/spacewalk-repo-sync', '--channel', 'res-7-suse-manager-tools-x86_64-ol7', '--type', 'yum', '--non-interactive']
2024/01/11 22:25:58 +08:00 Sync of channel started.
2024/01/11 22:26:10 +08:00 Repo URL: https://updates.suse.com/repo/$RCE/RES7-SUSE-Manager-Tools/x86_64/?<token>
2024/01/11 22:26:10 +08:00     Packages in repo:              1689
2024/01/11 22:26:14 +08:00     Packages already synced:        578
2024/01/11 22:26:14 +08:00     Packages to sync:              1111
2024/01/11 22:26:14 +08:00     New packages to download:         0
2024/01/11 22:26:14 +08:00   Downloading packages:
2024/01/11 22:26:14 +08:00 Importing packages started.
2024/01/11 22:26:14 +08:00
2024/01/11 22:26:14 +08:00   Importing packages to DB:
2024/01/11 22:26:14 +08:00   Package batch #1 of 56 completed...
...中間省略
2024/01/11 22:26:29 +08:00 Add Patch client-tools-201811-13899
2024/01/11 22:26:29 +08:00 Add Patch client-tools-201811-13900
2024/01/11 22:26:29 +08:00 Add Patch salt-201811-13898
2024/01/11 22:26:29 +08:00     Syncing 111 new patch(es) to channel.
2024/01/11 22:26:33 +08:00   Regenerating bootstrap repositories.
2024/01/11 22:26:38 +08:00 Sync completed.

2.5. Trouble Shooting

2.5.1. 透過 CLI 重新同步 Channel

$ sudo mgr-sync sync channel <channel_name>

2.5.2. 在 SCC 有新增 Product 的訂閱,但是 SUSE Manager Server 沒有認到

Refresh the local copy of products, channels, and subscriptions

$ sudo mgr-sync -d 3 refresh

2.5.3. mgr-sync log 檔案所在的位置

  • /var/log/rhn/mgr-sync.log
  • /var/log/rhn/rhn_web_api.log

3. 建立 Activation Key

3.1. 手動創建 bootstrap 倉庫

在 SUSE Manager Server 執行以下命令

$ sudo mgr-create-bootstrap-repo --create oracle-7-x86_64

3.2. 創建 Activation_Key

$ spacecmd -- activationkey_create \
-n oracle-linux-7 \
-d oracle-linux-7 \
-b oraclelinux7-x86_64 \
-e virtualization_host

activationkey_create 參數介紹 :

3.3. 創建 Bootstrap Script

$ sudo mgr-bootstrap \
--activation-key=1-oracle-linux-7 \
--gpg-key=/srv/www/htdocs/pub/ol67-gpg-pubkey-72F97B74EC551F03.key \
--script=bootstrap-oracle-linux-7.sh

4. 將 Orcale Linux 7 註冊為 Client

4.1. SSH 連線至 Orcale Linux 7 主機

4.2. 禁用 Public 套件儲存庫

$ find /etc/yum.repos.d/ -type f -not -name susemanager*.repo | xargs sed -i 's/enabled=1/enabled=0/g'

4.3. 禁用與 susemanager 不相關的 yum plugin

$ find /etc/yum/pluginconf.d/ -type f -not -name susemanager*.conf | xargs sed -i 's/enabled = 1/enabled = 0/g'

$ find /etc/yum/pluginconf.d/ -type f -not -name susemanager*.conf | xargs sed -i 's/enabled=1/enabled=0/g'

4.3. 執行 Bootstrap Script 註冊

$ curl -k https://<SUMA_FQDN>/pub/bootstrap/bootstrap-oracle-linux-7.sh | sudo bash

螢幕輸出 :

......................以上省略
REGISTRATION
------------
* registering
Using activation key: 1-liberty-linux-7
* removing TLS certificate used for bootstrap
  (will be re-added via salt state)
* starting salt daemon and enabling it during boot
Created symlink from /etc/systemd/system/multi-user.target.wants/venv-salt-minion.service to /usr/lib/systemd/system/venv-salt-minion.service.
-bootstrap complete-

4.4. 在 SUSE Manager Web UI 上同意 Salt Key

點擊左側選單 Salt -> Keys

image

4.5. 檢查 Packages Repository

執行以下命令,列出已啟用的 Packages Repository

$ sudo yum repolist enabled

螢幕輸出 :

repo id                                                             repo name                                                   status
susemanager:oraclelinux7-x86_64                                     oraclelinux7 for x86_64                                     21,237
susemanager:res-7-suse-manager-tools-x86_64-ol7                     RES-7-SUSE-Manager-Tools for x86_64 OL7                      1,111
repolist: 22,348

4.6. 檢查 Client 端基本資訊

4.6.1 在 SUSE Manager Server Web UI 檢視 Client 端的資訊

SUSEManager > Systems > Overview

image

4.6.2 透過 CLI 的方式檢查 Client 系統資訊

在 SUSE Manager Server 執行以下命令

$ spacecmd -q -- system_details orcale7

螢幕輸出 :

Name:          orcale7
System ID:     1000010007
UUID:          af9895b6a5db40ee90920743d1f1b33d
Locked:        False
Registered:    20240112T14:44:40
Last Checkin:  20240112T14:47:20
OSA Status:    unknown
Last Boot:     20240112T13:57:02
Contact Method:default

Hostname:      orcale7
IP Address:    xxx.xxx.xxx.xxx
Kernel:        5.4.17-2102.201.3.el7uek.x86_64

Activation Keys
---------------
1-oracle-linux-7

Software Channels
-----------------
oraclelinux7-x86_64
  |-- res-7-suse-manager-tools-x86_64-ol7
  |-- oracle7v2-media

Entitlements
------------
salt_entitled

4.7. 測試系統更新

在 SUSE Manager Client 執行以下命令

$ sudo yum update

螢幕輸出 :

... 以上省略
Transaction Summary
====================================================================
Install    7 Packages (+39 Dependent packages)
Upgrade  138 Packages

Total download size: 533 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/184): NetworkManager-config-server-1.18.8-2.0.1.el7_9.noarch.rpm       | 151 kB  00:00:00
... 中間省略
------------------------------------------------------------------
Total                                                                36 MB/s | 533 MB  00:00:14
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 1:grub2-common-2.02-0.87.0.25.el7.9.11.noarch            1/328

... 中間省略

Installed:
  kernel.x86_64 0:3.10.0-1160.105.1.0.1.el7 ...

Dependency Installed:
  iwlax2xx-firmware.noarch 999:20231102-999.29.el7 ...

Updated:
  NetworkManager.x86_64 1:1.18.8-2.0.1.el7_9 ...

Replaced:
  python-hwdata.noarch 0:1.7.3-4.el7 ...

Complete!

4.7.2 重啟系統

$ sudo reboot

4.7.3. 再次更新測試

$ sudo yum update

螢幕輸出應該如下 :

Loaded plugins: susemanagerplugin, venv-yumnotify
No packages marked for update

4.7.4. 在 SUSE Manager Server Web UI 檢視 Client 端的資訊

image

Basic HA TroubleshootingRegistering SUSE Liberty Linux 7 Clients