안녕하세요, Centos의 Stream OS정책이 발표된지 어느덧 8개월이 지났습니다

이것은 Centos8의 지원종료일이 4개월 남았다는것을 의미하기도 합니다

저는 개인적으로 Redhat계열의 OS를 선호 합니다 그래서 꾸준하게 Centos를 사용해 왔구요..

정책 발표이후 Rocky Linux와 같이 Centos의 대체제가 바로 발표 되었지만 많은 분들이 Centos 꼴 나는거 아니야? 하면서 ubuntu로 전환을 하시기도 했습니다

그러나 역시나 많은 분들이 Redhat의 안정성과 Redhat의 날리지베이스를 활용할 수 있다는 점때문에 대체제를 고민하며 관망하고도 있습니다 이제는 선택을 할때가 됬습니다 지원종료일이 4개월밖에 남지 않았거든요..

최근 Rocky Linux가 GA 릴리즈 되어 저는 Rokcy Linux로의 전환을 결정 하였습니다 과거의 Centos 정책을 따르는것과 Centos의 창시자가 다시 만들었다는점, AWS와 네이버가 스폰서 한다는점 등이 저의 결정에 영향을 주었습니다

이 포스트는 저같은 결정을 하신분들에게 OS 재설치 없이 Centos8 to Rocky Linux로의 스위칭을 가이드 합니다


먼저 포스팅에 사용한 OS는 Centos8 lastest 버전입니다(8.4.2105) 또한 프로덕션 환경을 재현하기 위해 minimal 설치나 cloud 이미지를 사용하지 않고 Server With GUI 패키지를 설치 하였습니다

작업에 사용한 스크립트는 Rocky Linux재단의 제품이지만 100% 안정성을 보장하지 않으므로 작업전 Full Backup과 충분한 장애 대처 시나리오를 준비하신 후 작업 하시기 바랍니다

 

저는 이전에 rhel to oel rhel to centos 등의 여러 OS switching 경험이 있습니다

 

모두 수동으로 패키지를 reinstall하고 수행했지만 이러한 작업들이 자동으로 수행되도록 스크립트를 만들어 제공해주어 해당 스크립트를 통해 작업을 진행 해 보겠습니다

 

 

[root@switch ~]# rpm -qa |wc -l
1382

cat /etc/centos-release
CentOS Linux release 8.4.2105

작업 대상 CentOS에는 현재 총 1382개의 패키지가 설치 되어 있습니다

 

 

모든 패키지에는 Packager와 Build Host, Vendor에 Centos에 대한 정보가 들어가 있습니다

 

아래 예시로 bash 패키지를 확인 해 봅니다

[root@switch ~]# rpm -qi bash
Name        : bash
Version     : 4.4.19
Release     : 14.el8
Architecture: x86_64
Install Date: Fri 23 Jul 2021 04:43:31 PM KST
Group       : Unspecified
Size        : 6861620
License     : GPLv3+
Signature   : RSA/SHA256, Wed 13 Jan 2021 12:21:35 AM KST, Key ID 05b555b38483c65d
Source RPM  : bash-4.4.19-14.el8.src.rpm
Build Date  : Tue 12 Jan 2021 05:27:45 PM KST
Build Host  : x86-01.mbox.centos.org
Relocations : (not relocatable)
Packager    : CentOS Buildsys <bugs@centos.org>
Vendor      : CentOS
URL         : https://www.gnu.org/software/bash
Summary     : The GNU Bourne Again shell
Description :
The GNU Bourne Again shell (Bash) is a shell or command language
interpreter that is compatible with the Bourne shell (sh). Bash
incorporates useful features from the Korn shell (ksh) and the C shell
(csh). Most sh scripts can be run by bash without modification.

최종 스위칭이 완료되면 모두 rocky linux에서 packaging 한 패키지가 설치되어야 합니다

 

 

이제 스위칭을 진행 합니다

 

rocky linux github에서 제공하는 switch 스크립트를 사용 할 것 입니다

 

https://github.com/rocky-linux/rocky-tools/tree/main/migrate2rocky

 

GitHub - rocky-linux/rocky-tools

Contribute to rocky-linux/rocky-tools development by creating an account on GitHub.

github.com

 

해당 스크립트를 이용하려면 공식 rocky linux repo와 연결이 가능하여야 합니다

 

폐쇠망 사용자라면 폐쇠망 내에 rocky linux repo서버를 구성하고 스크립트내 repo주소를 수정하여 작업 하시기 바랍니다

 

 

스크립트를 내려 받습니다

[root@switch ~]# wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
--2021-08-12 12:36:32--  https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30835 (30K) [text/plain]
Saving to: ‘migrate2rocky.sh’

migrate2rocky.sh                                   100%[================================================================================================================>]  30.11K  --.-KB/s    in 0.009s  

2021-08-12 12:36:33 (3.27 MB/s) - ‘migrate2rocky.sh’ saved [30835/30835]

 

도움말을 확인 합니다

 

[root@switch ~]# bash migrate2rocky.sh 
Usage: migrate2rocky.sh [OPTIONS]

Options:
-h Display this help
-r Convert to rocky
-V Verify switch
   !! USE WITH CAUTION !!

 

-r 옵션을 주고 수행 합니다

 

[root@switch ~]# bash migrate2rocky.sh -r

Removing dnf cache
Preparing to migrate CentOS Linux 8 to Rocky Linux 8.

Determining repository names for CentOS Linux 8.

 

수행하면 먼저 깔려있는 패키지와 rocky repo에 패키지를 비교 합니다

 

현재 시스템에 enabled 되어있는 모든 repo를 체크하므로 불필요하거나 OS  repo 외에는 disable 하고 사용하세요

 

첫번째로 업데이트가 필요한 패키지가 업데이트 됩니다

Running dnf update before we attempt the migration.
Last metadata expiration check: 0:01:03 ago on Thu 12 Aug 2021 12:45:30 PM KST.
Dependencies resolved.
=================================================================================================================
 Package                                       Arch    Version                                   Repo        Size
=================================================================================================================
Installing:
 kernel                                        x86_64  4.18.0-305.12.1.el8_4                     baseos     5.9 M
 kernel-core                                   x86_64  4.18.0-305.12.1.el8_4                     baseos      36 M
 kernel-modules                                x86_64  4.18.0-305.12.1.el8_4                     baseos      28 M
Upgrading:
 NetworkManager                                x86_64  1:1.30.0-10.el8_4                         baseos     2.6 M
 NetworkManager-adsl                           x86_64  1:1.30.0-10.el8_4                         baseos     141 k
 NetworkManager-bluetooth                      x86_64  1:1.30.0-10.el8_4                         baseos     167 k
 NetworkManager-config-server                  noarch  1:1.30.0-10.el8_4                         baseos     128 k
 NetworkManager-libnm                          x86_64  1:1.30.0-10.el8_4                         baseos     1.8 M
 NetworkManager-team                           x86_64  1:1.30.0-10.el8_4                         baseos     146 k
 NetworkManager-tui                            x86_64  1:1.30.0-10.el8_4                         baseos     328 k
 NetworkManager-wifi                           x86_64  1:1.30.0-10.el8_4                         baseos     186 k
 NetworkManager-wwan                           x86_64  1:1.30.0-10.el8_4                         baseos     173 k
 bash                                          x86_64  4.4.20-1.el8_4                            baseos     1.5 M
 bind-export-libs                              x86_64  32:9.11.26-4.el8_4                        baseos     1.1 M
 bind-libs                                     x86_64  32:9.11.26-4.el8_4                        appstream  174 k
 bind-libs-lite                                x86_64  32:9.11.26-4.el8_4                        appstream  1.2 M

수동으로 작업시 버전변경을 최소화 하고 싶다면 해당작업을 마지막에(reinstall된 패키지를 제외하고) 수행하는것이 좋습니다

 

보통 직접 작업시 해당 작업을 마지막에 수행하여 업그레이드가 꼭 필요한 패키지만 업그레이드 하도록 합니다

 

꼭 필요한 패키지는 취약점 패치로 인해 원버전이 사라져 reinstall 이 불가능한 패키지입니다

 

 

 

 

 

두번째로는 logo와 gpgkey, release 패키지등이 centos에서 rocky로 대체 되어 집니다

 

> > > ================================================================================
 Package                 Arch      Version              Repository         Size
================================================================================
Installing:
 rocky-backgrounds       noarch    84.5-8.el8           rockyappstream    330 k
 rocky-gpg-keys          noarch    8.4-32.el8           rockybaseos        11 k
 rocky-indexhtml         noarch    8.0-0.el8            rockybaseos       266 k
 rocky-logos             x86_64    84.5-8.el8           rockybaseos       328 k
 rocky-release           noarch    8.4-32.el8           rockybaseos        20 k
 rocky-repos             noarch    8.4-32.el8           rockybaseos        13 k
Removing:
 centos-backgrounds      noarch    85.8-1.el8           @appstream         23 M
 centos-gpg-keys         noarch    1:8-2.el8            @anaconda         3.3 k
 centos-indexhtml        noarch    8.0-0.el8            @anaconda         505 k
 centos-linux-release    noarch    8.4-1.2105.el8       @anaconda          25 k
 centos-linux-repos      noarch    8-2.el8              @anaconda          26 k
 centos-logos            x86_64    85.8-1.el8           @baseos           716 k

Transaction Summary
================================================================================

 

두번째 작업이 완료되면 다음으로 패키지 reinstall이 진행 됩니다

 

reinstall대상 패키지는 현재 버전과 동일한 버전의 rocky linux 패키지가 있을때 수행 됩니다

 

현재의 환경을 유지한채 대상 패키지들이 reinstall 됩니다

 

대부분의 패키지들이 reinstall 되고 제일 시간이 오래 소요 됩니다

  Running scriptlet: setup-2.12.2-6.el8.noarch                           5/2699 
  Reinstalling     : filesystem-3.8-3.el8.x86_64                         6/2699 
  Reinstalling     : urw-base35-fonts-common-20170801-10.el8.noarch      7/2699 
  Reinstalling     : xkeyboard-config-2.28-1.el8.noarch                  8/2699 
  Reinstalling     : tzdata-2021a-1.el8.noarch                           9/2699 
  Downgrading      : gnu-free-fonts-common-20120503-18.el8.noarch       10/2699

 

 

커널은 새로운 버전의 rokcy kernel이 설치 됩니다

 

버전을 유지하고 싶거나 수동으로 작업시 아래 방법을 참조하세요

 

yum 사용시 현재 running kernel은 삭제하거나 reinstall 할 수 없습니다

 

새로운버전의 커널을 설치하거나 rpm명령어를 이용하여 삭제하고 재설치 할 수 있습니다

 

 

# rpm -e --nodeps kernel-4.18.0-305.3.1.el8.x86_64.rpm

# yum install -y kernel-4.18.0-305.3.1.el8.x86_64.rpm

 

최종작업이 완료되면 아래와 같은 메시지가 출력 됩니다

 

Complete!
Subscription Manager found on system.
If you're converting from a subscription-managed distribution such as RHEL then
you may no longer need subscription-manager or dnf-plugin-subscription-manager.
While it won't hurt anything to have it on your system you may be able to safely
remove it with:

"dnf remove subscription-manager dnf-plugin-subscription-manager".

Take care that it doesn't remove something that you want to keep.

The subscription-manager dnf plugin may be enabled for the benefit of
Subscription Management. If no longer desired, you can use
"subscription-manager config --rhsm.auto_enable_yum_plugins=0" to block this
behavior.

Generating grub configuration file ...
File descriptor 3 (/dev/pts/2) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 4 (/dev/pts/2) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 5 (/var/log/migrate2rocky.log) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 3 (/dev/pts/2) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 4 (/dev/pts/2) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 5 (/var/log/migrate2rocky.log) leaked on vgs invocation. Parent PID 567534: /usr/sbin/grub2-probe
File descriptor 3 (/dev/pts/2) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
File descriptor 4 (/dev/pts/2) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
File descriptor 5 (/var/log/migrate2rocky.log) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
File descriptor 3 (/dev/pts/2) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
File descriptor 4 (/dev/pts/2) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
File descriptor 5 (/var/log/migrate2rocky.log) leaked on vgs invocation. Parent PID 569854: /usr/sbin/grub2-probe
Adding boot menu entry for EFI firmware configuration
done
BootCurrent: 0004
Timeout: 0 seconds
BootOrder: 0001,0004,0002,0000,0003
Boot0000* UiApp
Boot0002* UEFI QEMU QEMU HARDDISK 
Boot0003* EFI Internal Shell
Boot0004* CentOS Linux
Boot0001* Rocky Linux

Done, please reboot your system.



A log of this installation can be found at /var/log/migrate2rocky.log

재부팅 하면

 

위와같이 rokcy linux 커널이 기본으로 선택되어 있습니다

 

 

로고도 rocky로 잘 변경 되었습니다

 

 

최종적으로 패키지를 확인 합니다

 

[root@switch ~]# rpm -qa |wc -l
1372
[root@switch ~]# rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE} - %{BUILDHOST}\n' | grep centos.org$
kernel-core-4.18.0-305.12.1.el8_4 - kbuilder.bsys.centos.org
kernel-core-4.18.0-305.3.1.el8 - kbuilder.bsys.centos.org
kernel-4.18.0-305.12.1.el8_4 - kbuilder.bsys.centos.org
kernel-modules-4.18.0-305.3.1.el8 - kbuilder.bsys.centos.org
kernel-4.18.0-305.3.1.el8 - kbuilder.bsys.centos.org
kernel-modules-4.18.0-305.12.1.el8_4 - kbuilder.bsys.centos.org

 

아직 builhost가 centos 인 패키지가 남아있으나 위에 설명드린대로 kernel입니다. 삭제하면 됩니다

 

[root@switch ~]# rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE} - %{BUILDHOST}\n' | grep centos.org$ > remove
[root@switch ~]# yum remove `cat remove` -y
No match for argument: -
No match for argument: kbuilder.bsys.centos.org
Dependencies resolved.
============================================================================================================================================================================================================
 Package                                           Architecture                              Version                                                     Repository                                    Size
============================================================================================================================================================================================================
Removing:
 kernel                                            x86_64                                    4.18.0-305.3.1.el8                                          @anaconda                                      0  
 kernel                                            x86_64                                    4.18.0-305.12.1.el8_4                                       @baseos                                        0  
 kernel-core                                       x86_64                                    4.18.0-305.3.1.el8                                          @anaconda                                     67 M
 kernel-core                                       x86_64                                    4.18.0-305.12.1.el8_4                                       @baseos                                       67 M
 kernel-modules                                    x86_64                                    4.18.0-305.3.1.el8                                          @anaconda                                     22 M
 kernel-modules                                    x86_64                                    4.18.0-305.12.1.el8_4                                       @baseos                                       22 M

Transaction Summary
============================================================================================================================================================================================================
Remove  6 Packages

Freed space: 177 M
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                    1/1 
  Erasing          : kernel-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                                1/6 
  Running scriptlet: kernel-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                                1/6 
  Erasing          : kernel-4.18.0-305.3.1.el8.x86_64                                                                                                                                                   2/6 
  Running scriptlet: kernel-4.18.0-305.3.1.el8.x86_64                                                                                                                                                   2/6 
  Erasing          : kernel-modules-4.18.0-305.3.1.el8.x86_64                                                                                                                                           3/6 
  Running scriptlet: kernel-modules-4.18.0-305.3.1.el8.x86_64                                                                                                                                           3/6 
  Erasing          : kernel-modules-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                        4/6 
  Running scriptlet: kernel-modules-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                        4/6 
  Running scriptlet: kernel-core-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                           5/6 
  Erasing          : kernel-core-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                           5/6 
  Running scriptlet: kernel-core-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                           5/6 
  Running scriptlet: kernel-core-4.18.0-305.3.1.el8.x86_64                                                                                                                                              6/6 
  Erasing          : kernel-core-4.18.0-305.3.1.el8.x86_64                                                                                                                                              6/6 
  Running scriptlet: kernel-core-4.18.0-305.3.1.el8.x86_64                                                                                                                                              6/6 
  Verifying        : kernel-4.18.0-305.3.1.el8.x86_64                                                                                                                                                   1/6 
  Verifying        : kernel-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                                2/6 
  Verifying        : kernel-core-4.18.0-305.3.1.el8.x86_64                                                                                                                                              3/6 
  Verifying        : kernel-core-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                           4/6 
  Verifying        : kernel-modules-4.18.0-305.3.1.el8.x86_64                                                                                                                                           5/6 
  Verifying        : kernel-modules-4.18.0-305.12.1.el8_4.x86_64                                                                                                                                        6/6 
Installed products updated.

Removed:
  kernel-4.18.0-305.3.1.el8.x86_64            kernel-4.18.0-305.12.1.el8_4.x86_64 kernel-core-4.18.0-305.3.1.el8.x86_64 kernel-core-4.18.0-305.12.1.el8_4.x86_64 kernel-modules-4.18.0-305.3.1.el8.x86_64
  kernel-modules-4.18.0-305.12.1.el8_4.x86_64

Complete!

 

최종 확인을 합니다

 

[root@switch ~]# rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE} - %{BUILDHOST}\n' | grep -v rockylinux.org$
gpg-pubkey-6d745a60-60287f36 - localhost
gpg-pubkey-2f86d6a1-5cf7cefb - localhost
epel-release-8-11.el8 - buildhw-x86-09.iad2.fedoraproject.org
gpg-pubkey-8483c65d-5ccc5b19 - localhost
gpg-pubkey-836f4beb-5fc97e5e - localhost
gpg-pubkey-3e1ba8d5-558ab6a8 - localhost
python3-cssselect-0.9.2-10.el8 - buildvm-14.phx2.fedoraproject.org
gpg-pubkey-307ea071-603d1059 - localhost
python3-beautifulsoup4-4.6.3-2.el8.1 - buildvm-aarch64-20.arm.fedoraproject.org
gpg-pubkey-621e9f35-58adea78 - localhost


[root@switch ~]# cat /etc/redhat-release 
Rocky Linux release 8.4 (Green Obsidian)
[root@switch ~]# cat /etc/rocky-release
Rocky Linux release 8.4 (Green Obsidian)

위와같이 rockylinux 패키지가 아닌것은 gpgkey와 epel 패키지 뿐이며 모든 패키지가 rockylinux에서 패키징한 패키지로 재 설치 되었습니다

 

 

+ Recent posts