星期六, 3月 16, 2019

Migrate from openSUSE Leap to SUSE Linux Enterprise Server in Azure

Migrate from openSUSE Leap to SUSE Linux Enterprise Server in Azure

OS: openSUSE Leap 15 in Azure

之前 openSUSE.Asia summit 2018 就有人發表 openSUSE Leap migrate 到 SLES, 今天看到有人 post 相關 link, 就想說來實際 Lab 一下.

按照官方網站的說明先說一下, 建議這樣的方式是在測試環境中執行 :)

升級路徑參考


開始之前先觀察相關資訊

# cat   /etc/*release

NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"


# zypper  lr

Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias                      | Name           | Enabled | GPG Check | Refresh
--+----------------------------+-----------------------------------------+---------+-----------+--------
1 | openSUSE-Leap-15.0--Debug  | openSUSE-Leap-15.0-Debug           | No | ---- | ----
2 | openSUSE-Leap-15.0-Non-Oss | openSUSE-Leap-15.0-Non-Oss              | Yes | ( p) Yes | Yes
3 | openSUSE-Leap-15.0-Oss     | openSUSE-Leap-15.0-Oss           | Yes | ( p) Yes | Yes
4 | openSUSE-Leap-15.0-Source  | openSUSE-Leap-15.0-Source           | No | ---- | ----
5 | openSUSE-Leap-15.0-Update  | openSUSE-Leap-15.0-Update           | Yes | ( p) Yes | Yes
6 | openSUSE-Leap-cloud-tools  | openSUSE-Leap-Cloud-Tools           | Yes | ( p) Yes | Yes
7 | repo-debug-update          | openSUSE-Leap-15.0-Update-Debug         | No | ---- | ----
8 | repo-debug-update-non-oss  | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No      | ---- | ----
9 | repo-update-non-oss        | openSUSE-Leap-15.0-Update-Non-Oss       | Yes | ( p) Yes | Yes


# zypper  search SUSEConnect

Loading repository data...
Reading installed packages...

S | Name        | Summary                                             | Type
--+-------------+------------------------------------------------------------+-----------
i | SUSEConnect | Utility to register a system with the SUSE Customer Center | package   

openSUSE Leap 15 in Azure 預設安裝 SUSEConnect
  • 我確認過我的 Desktop 預設沒有安裝 SUSEConnect

# zypper  search  yast2-brand

Loading repository data...
Reading installed packages...

S | Name                           | Summary       | Type
--+--------------------------------+-----------------------------------------+--------
 | yast2-branding-openSUSE        | YaST2 - Theme (openSUSE)         | package
 | yast2-branding-openSUSE-Oxygen | YaST2 - switcher into Oxygen icon theme | package

openSUSE Leap 15 in Azure 預設沒有裝 yast2-branding-openSUSE相關套件
  • 我確認我的 Desktop 預設裝 yast2-branding-openSUSE


開始進行 Migrate 流程

安裝 SUSEConnect 套件 ( openSUSE Leap 15 in Azure 已經內建 )
# zypper  in  SUSEConnect

Loading repository data...
Reading installed packages...
'SUSEConnect' is already installed.
No update candidate for 'SUSEConnect-0.3.12-lp150.2.9.1.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.

移除 yast2-brainding-openSUSE 相關套件 ( openSUSE Leap 15 in Azure 沒有裝 )
# rpm  -e  --nodeps yast2-branding-openSUSE
error: package yast2-branding-openSUSE is not installed

# rpm  -e  --nodeps yast2-branding-openSUSE-Oxygen

error: package yast2-branding-openSUSE-Oxygen is not installed

確認 SUSEConnect 註冊狀況

# SUSEConnect  -s
[{"identifier":"openSUSE","version":"15.0","arch":"x86_64","status":"Not Registered"}]


SUSEConnect 需要使用 REGISTRATION_CODE 來註冊, 如果沒有提供註冊碼會被提示要提供

# SUSEConnect  -p  SLES/15.0/x86_64

Please register your system using the --regcode parameter, or provide the --url parameter to register against SMT.

如何取得 SCC 帳戶還有試用註冊碼?
到這邊


選取 SLES 的版本還有硬體類型 ( 例如 AMD64 / Intel 64 )
填入相關資訊就可以取得


所以要到 SCC   https://scc.suse.com/login
登入到 SUSE Customer Center


如果有註冊碼, 可以在右邊 Activate subscriptions 啟用他


可以在 subscriptions 那邊觀察到已經被啟用



進行註冊
# SUSEConnect  -r  YOUR_REGIST_CODE -p  SLES/15.0/x86_64

Registered SLES 15.0 x86_64
To server: https://scc.suse.com
Successfully registered system.


確認 SUSEConnect 註冊狀況

# SUSEConnect  -s

[{"identifier":"SLES","version":"15","arch":"x86_64","status":"Registered","regcode":"YOUR_REGIST_CODE","starts_at":"2019-03-16 10:43:00 UTC","expires_at":"2019-05-15 10:43:00 UTC","subscription_status":"ACTIVE","type":"oem"}]

這邊就會發現已經註冊了, 然後也會看到到期日

# zypper lr

Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                                                                       | Name | Enabled | GPG Check | Refresh
---+-----------------------------------------------------------------------------+-----------------------------------------+---------+-----------+--------
1 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Debuginfo-Pool    | SLE-Product-SLES15-Debuginfo-Pool | No | ---- | ----
2 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Debuginfo-Updates | SLE-Product-SLES15-Debuginfo-Updates    | No | ---- | ----
3 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Pool              | SLE-Product-SLES15-Pool | Yes | (r ) Yes | No
4 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Source-Pool       | SLE-Product-SLES15-Source-Pool | No | ---- | ----
5 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Updates           | SLE-Product-SLES15-Updates | Yes | (r ) Yes | Yes    
6 | openSUSE-Leap-15.0--Debug                                                   | openSUSE-Leap-15.0-Debug | No | ---- | ----
7 | openSUSE-Leap-15.0-Non-Oss                                                  | openSUSE-Leap-15.0-Non-Oss | Yes     | (r ) Yes  | Yes
8 | openSUSE-Leap-15.0-Oss                                                      | openSUSE-Leap-15.0-Oss | Yes     | (r ) Yes  | Yes
9 | openSUSE-Leap-15.0-Source                                                   | openSUSE-Leap-15.0-Source | No | ---- | ----
10 | openSUSE-Leap-15.0-Update                                                   | openSUSE-Leap-15.0-Update | Yes     | (r ) Yes  | Yes
11 | openSUSE-Leap-cloud-tools                                                   | openSUSE-Leap-Cloud-Tools | Yes     | (r ) Yes  | Yes
12 | repo-debug-update                                                           | openSUSE-Leap-15.0-Update-Debug | No | ---- | ----
13 | repo-debug-update-non-oss                                                   | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No | ---- | ----
14 | repo-update-non-oss                                                         | openSUSE-Leap-15.0-Update-Non-Oss | Yes     | (r ) Yes  | Yes

比對之前的資訊就會發現多了 5 個 SLES 的 repos

接下來停用 openSUSE 相關的 repos
  • -d 後面是 repo 的號碼, 可以一次放多個

# zypper  mr  -d  7 8 10 11 14

Repository 'openSUSE-Leap-15.0-Non-Oss' has been successfully disabled.
Repository 'openSUSE-Leap-15.0-Oss' has been successfully disabled.
Repository 'openSUSE-Leap-15.0-Update' has been successfully disabled.
Repository 'openSUSE-Leap-cloud-tools' has been successfully disabled.
Repository 'repo-update-non-oss' has been successfully disabled.

再次觀察

# zypper  lr

Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                                                                       | Name | Enabled | GPG Check | Refresh
---+-----------------------------------------------------------------------------+-----------------------------------------+---------+-----------+--------
1 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Debuginfo-Pool    | SLE-Product-SLES15-Debuginfo-Pool | No | ---- | ----
2 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Debuginfo-Updates | SLE-Product-SLES15-Debuginfo-Updates    | No | ---- | ----
3 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Pool              | SLE-Product-SLES15-Pool | Yes     | (r ) Yes  | No
4 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Source-Pool       | SLE-Product-SLES15-Source-Pool | No | ---- | ----
5 | SUSE_Linux_Enterprise_Server_15_x86_64:SLE-Product-SLES15-Updates           | SLE-Product-SLES15-Updates | Yes     | (r ) Yes  | Yes
6 | openSUSE-Leap-15.0--Debug                                                   | openSUSE-Leap-15.0-Debug | No | ---- | ----
7 | openSUSE-Leap-15.0-Non-Oss                                                  | openSUSE-Leap-15.0-Non-Oss | No | ---- | ----
8 | openSUSE-Leap-15.0-Oss                                                      | openSUSE-Leap-15.0-Oss | No | ---- | ----
9 | openSUSE-Leap-15.0-Source                                                   | openSUSE-Leap-15.0-Source | No | ---- | ----
10 | openSUSE-Leap-15.0-Update                                                   | openSUSE-Leap-15.0-Update | No | ---- | ----
11 | openSUSE-Leap-cloud-tools                                                   | openSUSE-Leap-Cloud-Tools | No | ---- | ----
12 | repo-debug-update                                                           | openSUSE-Leap-15.0-Update-Debug | No | ---- | ----
13 | repo-debug-update-non-oss                                                   | openSUSE-Leap-15.0-Update-Debug-Non-Oss | No | ---- | ----
14 | repo-update-non-oss                                                         | openSUSE-Leap-15.0-Update-Non-Oss | No | ---- | ----

列出所有 extensions 的啟用方式

# SUSEConnect --list-extensions

AVAILABLE EXTENSIONS AND MODULES
   Basesystem Module 15 x86_64
   Activate with: SUSEConnect -p sle-module-basesystem/15/x86_64
       Containers Module 15 x86_64
       Activate with: SUSEConnect -p sle-module-containers/15/x86_64
SUSE Linux Enterprise Live Patching 15 x86_64
       Activate with: SUSEConnect -p sle-module-live-patching/15/x86_64 -r ADDITIONAL REGCODE

恕略….

上面會列出想要啟用的模組, 然後啟用的指令, 有些會提醒需要額外的 code
這邊跟官方文件一樣, 啟用 basesystem 來試試看

# SUSEConnect  -p  sle-module-basesystem/15/x86_64

Registered sle-module-basesystem 15 x86_64
To server: https://scc.suse.com
Successfully registered system.

再次觀察 SUSEConnect 就會發現剛剛啟用的 module
# SUSEConnect  -s

[{"identifier":"SLES","version":"15","arch":"x86_64","status":"Registered","regcode":"YOUR_REGIST_CODE","starts_at":"2019-03-16 10:43:00 UTC","expires_at":"2019-05-15 10:43:00 UTC","subscription_status":"ACTIVE","type":"oem"},{"identifier":"sle-module-basesystem","version":"15","arch":"x86_64","status":"Registered"}]

官方建議視自己的用途啟用相關 module, 例如 Desktop 之類的

進行 migrate
# zypper  dup  --force-resolution

Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Refreshing service 'Basesystem_Module_15_x86_64'.
Refreshing service 'SUSE_Linux_Enterprise_Server_15_x86_64'.
Loading repository data...
Reading installed packages...
Computing distribution upgrade...
The following pattern is going to change vendor:
 minimal_base  openSUSE -> SUSE LLC <https://www.suse.com/>

The following package is not supported by its vendor:
 zypper-search-packages-plugin
恕略
504 packages to upgrade, 2 to downgrade, 177 new, 9 to remove, 506  to change vendor.
Overall download size: 377.0 MiB. Already cached: 0 B. After the operation, additional 522.2 MiB will be used.
Continue? [y/n/...? shows all options] (y): Y

移除被孤立的套件
# zypper  rm  $(zypper --no-refresh packages --orphaned | gawk '{print $5}' | tail -n +5)

Loading repository data...
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.
Reading installed packages...
Resolving package dependencies...

The following 20 packages are going to be REMOVED:
 SuSEfirewall2 at azuremetadata blktrace catatonit cloud-netconfig-azure containerd crash docker docker-libnetwork docker-runc libzstd1 opie python-azure-agent
 python-tdb python-tevent python3-distro release-notes-openSUSE strace systemd-presets-common-SUSE

20 packages to remove.
After the operation, 104.5 MiB will be freed.
Continue? [y/n/...? shows all options] (y):


按照官方建議 重開機
# reboot

但是說實在的, 如果是這樣的話, 個人覺得可能新安裝個 SLES 15 比較快
除非是不得已 :p

這樣也算是多學一項技能了

~ enjoy it

Reference:

沒有留言: