LoginSignup
4
2

More than 1 year has passed since last update.

CentOS8からCentOS Stream8への移行と指定のカーネルへのアップデート

Last updated at Posted at 2021-06-10

背景

CentOS Stream8は2021年6月現在isoからインストールするとすでにカーネルのバージョンが4.18.0-310.el8となっている
→検証でこれより低い指定のカーネル(本記事は4.18.0-269.el8.x86_64)の環境を使用したい
→リポジトリの関係でコマンドからダウングレードができなかったので、CentOS8からCentOS Stream8へ移行し、最新までアップデートせずに指定のバージョンまで手動でカーネルアップデートした

手順

現バージョン確認

# cat /etc/centos-release
CentOS Linux release 8.2.2004 (Core)

# uname -r
4.18.0-193.19.1.el8_2.x86_64

リポジトリの確認

# yum repolist
repo id                                                                                  repo の名前
AppStream                                                                                CentOS-8 - AppStream
BaseOS                                                                                   CentOS-8 - Base
extras                                                                                   CentOS-8 - Extras

# ls -l /etc/yum.repos.d/
合計 52
-rw-r--r--. 1 root root  731  9月 16  2020 CentOS-AppStream.repo
-rw-r--r--. 1 root root  712  9月 16  2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1043  9月 16  2020 CentOS-CR.repo
-rw-r--r--. 1 root root  668  9月 16  2020 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  743  9月 16  2020 CentOS-Devel.repo
-rw-r--r--. 1 root root  756  9月 16  2020 CentOS-Extras.repo
-rw-r--r--. 1 root root  738  9月 16  2020 CentOS-HA.repo
-rw-r--r--. 1 root root  928  9月 16  2020 CentOS-Media.repo
-rw-r--r--. 1 root root  736  9月 16  2020 CentOS-PowerTools.repo
-rw-r--r--. 1 root root 1382  9月 16  2020 CentOS-Sources.repo
-rw-r--r--. 1 root root   74  9月 16  2020 CentOS-Vault.repo
-rw-r--r--. 1 root root  798  9月 16  2020 CentOS-centosplus.repo
-rw-r--r--. 1 root root  338  9月 16  2020 CentOS-fasttrack.repo

Streamのパッケージをインストール

# yum install centos-release-stream
メタデータの期限切れの最終確認: 0:13:26 時間前の 2021年06月10日 14時21分54秒 に実施しました。
依存関係が解決しました。
=============================================================================================================================================================================================
 パッケージ                                           アーキテクチャー                      バージョン                                           リポジトリー                          サイズ
=============================================================================================================================================================================================
インストール中:
 centos-release-stream                                x86_64                                8.1-1.1911.0.7.el8                                   extras                                 11 k

トランザクションの概要
=============================================================================================================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 11 k
インストール済みのサイズ: 6.6 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
centos-release-stream-8.1-1.1911.0.7.el8.x86_64.rpm                                                                                                          304 kB/s |  11 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                                                         9.9 kB/s |  11 kB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備              :                                                                                                                                                                    1/1
  インストール中    : centos-release-stream-8.1-1.1911.0.7.el8.x86_64                                                                                                                    1/1
  検証              : centos-release-stream-8.1-1.1911.0.7.el8.x86_64                                                                                                                    1/1

インストール済み:
  centos-release-stream-8.1-1.1911.0.7.el8.x86_64

完了しました!

Cent公式通りコマンドを入力

# dnf swap centos-linux-repos centos-stream-repos
メタデータの期限切れの最終確認: 0:01:52 時間前の 2021年06月10日 14時36分10秒 に実施しました。
No match for argument: centos-linux-repos
削除対象のパッケージはありません。
依存関係が解決しました。
=============================================================================================================================================================================================
 パッケージ                                            アーキテクチャー                       バージョン                                 リポジトリー                                  サイズ
=============================================================================================================================================================================================
インストール中:
 centos-stream-release                                 noarch                                 8.5-3.el8                                  Stream-BaseOS                                  22 k
     置き換え  centos-release.x86_64 8.2-2.2004.0.2.el8
     置き換え  centos-release-stream.x86_64 8.1-1.1911.0.7.el8
     置き換え  centos-repos.x86_64 8.2-2.2004.0.2.el8
 centos-stream-repos                                   noarch                                 8-2.el8                                    extras                                         19 k
アップグレード中:
 centos-gpg-keys                                       noarch                                 1:8-2.el8                                  BaseOS                                         12 k

トランザクションの概要
=============================================================================================================================================================================================
インストール    2 パッケージ
アップグレード  1 パッケージ

ダウンロードサイズの合計: 52 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/3): centos-stream-release-8.5-3.el8.noarch.rpm                                                                                                            553 kB/s |  22 kB     00:00
(2/3): centos-stream-repos-8-2.el8.noarch.rpm                                                                                                                357 kB/s |  19 kB     00:00
(3/3): centos-gpg-keys-8-2.el8.noarch.rpm                                                                                                                    1.4 kB/s |  12 kB     00:08
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                                                         1.7 kB/s |  52 kB     00:29
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備              :                                                                                                                                                                    1/1
  scriptlet の実行中: centos-gpg-keys-1:8-2.el8.noarch                                                                                                                                   1/1
  アップグレード中  : centos-gpg-keys-1:8-2.el8.noarch                                                                                                                                   1/7
  インストール中    : centos-stream-release-8.5-3.el8.noarch                                                                                                                             2/7
  インストール中    : centos-stream-repos-8-2.el8.noarch                                                                                                                                 3/7
  廃止              : centos-release-stream-8.1-1.1911.0.7.el8.x86_64                                                                                                                    4/7
  廃止              : centos-release-8.2-2.2004.0.2.el8.x86_64                                                                                                                           5/7
  廃止              : centos-repos-8.2-2.2004.0.2.el8.x86_64                                                                                                                             6/7
  整理              : centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                                          7/7
  scriptlet の実行中: centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                                          7/7
  検証              : centos-stream-repos-8-2.el8.noarch                                                                                                                                 1/7
  検証              : centos-stream-release-8.5-3.el8.noarch                                                                                                                             2/7
  検証              : centos-release-8.2-2.2004.0.2.el8.x86_64                                                                                                                           3/7
  検証              : centos-release-stream-8.1-1.1911.0.7.el8.x86_64                                                                                                                    4/7
  検証              : centos-repos-8.2-2.2004.0.2.el8.x86_64                                                                                                                             5/7
  検証              : centos-gpg-keys-1:8-2.el8.noarch                                                                                                                                   6/7
  検証              : centos-gpg-keys-8.2-2.2004.0.2.el8.noarch                                                                                                                          7/7

アップグレード済み:
  centos-gpg-keys-1:8-2.el8.noarch

インストール済み:
  centos-stream-release-8.5-3.el8.noarch                                                          centos-stream-repos-8-2.el8.noarch

完了しました!

再起動せずこの時点での情報を確認

# cat /etc/centos-release
CentOS Stream release 8
# uname -r
4.18.0-193.19.1.el8_2.x86_64

ここで公式通りdistro-syncをかけると最新kernelまでアップデートしてしまう

# yum distro-sync
CentOS Stream 8 - AppStream                                                                                                                                  7.4 MB/s | 9.6 MB     00:01
CentOS Stream 8 - BaseOS                                                                                                                                     8.7 MB/s | 6.7 MB     00:00
CentOS Stream 8 - Extras                                                                                                                                      22 kB/s |  13 kB     00:00
依存関係が解決しました。
=============================================================================================================================================================================================
 パッケージ                                              アーキテクチャー              バージョン                                                     リポジトリー                     サイズ
=============================================================================================================================================================================================
インストール中:
 kernel                                                  x86_64                        4.18.0-310.el8                                                 baseos                           6.2 M
 kernel-core                                             x86_64                        4.18.0-310.el8                                                 baseos                            36 M
 kernel-debug-devel                                      x86_64                        4.18.0-310.el8                                                 baseos                            19 M
 kernel-devel                                            x86_64                        4.18.0-310.el8                                                 baseos                            19 M
 kernel-modules                                          x86_64                        4.18.0-310.el8                                                 baseos                            28 M
アップグレード中:
 NetworkManager                                          x86_64                        1:1.32.0-0.4.el8                                               baseos                           2.6 M

~~~
トランザクションの概要
=============================================================================================================================================================================================
インストール     30 パッケージ
アップグレード  355 パッケージ

ダウンロードサイズの合計: 536 M
これでよろしいですか? [y/N]: N
操作が中断されました。     

yum.confにkernel除外設定をしてアップデート(distro-syncでも可)

# vi /etc/yum.conf
exclude=kernel*

# yum update

# systemctl reboot

必要なカーネルパッケージを用意し、マシンへ送信

# ls /tmp/
kernel-4.18.0-269.el8.x86_64.rpm
kernel-core-4.18.0-269.el8.x86_64.rpm
kernel-devel-4.18.0-269.el8.x86_64.rpm
kernel-headers-4.18.0-269.el8.x86_64.rpm
kernel-modules-4.18.0-269.el8.x86_64.rpm

rpmでアップデート

# rpm -ivh kernel-core-4.18.0-269.el8.x86_64.rpm
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:kernel-core-4.18.0-269.el8       ################################# [100%]

# rpm -ivh kernel-modules-4.18.0-269.el8.x86_64.rpm
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:kernel-modules-4.18.0-269.el8    ################################# [100%]


# rpm -ivh kernel-4.18.0-269.el8.x86_64.rpm
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:kernel-4.18.0-269.el8            ################################# [100%]


# rpm -Uvh kernel-headers-4.18.0-269.el8.x86_64.rpm
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:kernel-headers-4.18.0-269.el8    ################################# [ 50%]
整理中 / 削除中...
   2:kernel-headers-4.18.0-193.19.1.el################################# [100%]


# rpm -Uvh kernel-devel-4.18.0-269.el8.x86_64.rpm
Verifying...                          ################################# [100%]
準備しています...              ################################# [100%]
更新中 / インストール中...
   1:kernel-devel-4.18.0-269.el8      ################################# [ 33%]
整理中 / 削除中...
   2:kernel-devel-4.18.0-193.19.1.el8_################################# [ 67%]
   3:kernel-devel-4.18.0-80.el8       ################################# [100%]

# systemctl reboot

最終情報確認

# cat /etc/centos-release
CentOS Stream release 8

# uname -r
4.18.0-269.el8.x86_64

# yum distro-sync
メタデータの期限切れの最終確認: 0:46:22 時間前の 2021年06月10日 14時43分38秒 に実施しました。
依存関係が解決しました。
行うべきことはありません。
完了しました!

以上で完了
上記と別の方法があればぜひご教示ください

参考

https://www.centos.org/centos-stream/
https://serv-ops.com/blog/2020/12/22/centos-8-to-centos-stream/
・カーネルパッケージの取得先
https://koji.mbox.centos.org/koji/buildinfo?buildID=15499

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2