【備忘】カーネルのバージョンを指定して手動バージョンアップ

# 背景
kernelが必要なミドルウェアをシステムで利用している
AWS SystemsManagerからパッチ適用を行いkernelのアップデートを行っていた
→SystemsManagerでアップデートされた最新のバージョンではミドルウェア側が対応していなかったため、kernelのバージョンアップはパッチ適用時には除外し、手動でバージョンアップを行うことにした

# 環境
RHEL 8.8 (Ootpa)
kernel-4.18.0-477.21.1.el8_8.x86_64
→kernel-4.18.0-513.11.1.el8_9 (これにしたい)

# 手順

## パッチ適用の除外設定
kernelのバージョンのみ、SystemsManagerのパッチ適用からアップデートをしたくないので除外設定を行う
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3574230/824567e1-b962-8fb3-35d8-89483b73db4e.png)

  
パッチベースラインの編集から、除外したいkernel関連パッチを例外に設定し、拒否されたパッチのアクションを「ブロック」にする
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3574230/a8b5b4a7-5dfe-d7d5-cbe9-806a18c23429.png)


パッチの例外に反映されていることを確認
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3574230/0c291c47-27b4-7894-a4a7-6db3815c6a46.png)

　
パッチ適用時の例外設定が完了

## kernel手動アップデート
### 現在のバージョンを確認

```
[root@ip ~]# uname -r
4.18.0-477.21.1.el8_8.x86_64
[root@ip ~]# grubby --default-kernel
/boot/vmlinuz-4.18.0-477.21.1.el8_8.x86_64
```
　
　
### システムで利用できるkernelのバージョンを表示
```
[root@ip~]# dnf --showduplicate list kernel*
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.

Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs)                                                                                                                 65 kB/s | 4.5 kB     00:00
Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs)                                                                                                                 64 MB/s |  64 MB     00:01
Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs)                                                                                                                   114 kB/s | 4.1 kB     00:00
Red Hat Enterprise Linux 8 for x86_64 - BaseOS from RHUI (RPMs)                                                                                                                    63 MB/s |  70 MB     00:01
Red Hat Update Infrastructure 3 Client Configuration Server 8                                                                                                                      47 kB/s | 1.5 kB     00:00
Red Hat Update Infrastructure 3 Client Configuration Server 8                                                                                                                      64 kB/s | 3.5 kB     00:00
Last metadata expiration check: 0:00:01 ago on Fri 07 Jun 2024 01:33:12 AM UTC.
Installed Packages
kernel.x86_64                                                                                     4.18.0-348.el8                                                                        @System
kernel.x86_64                                                                                     4.18.0-477.21.1.el8_8                                                                 @rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-348.el8                                                                        @System
kernel-core.x86_64                                                                                4.18.0-477.21.1.el8_8                                                                 @rhel-8-baseos-rhui-rpms
kernel-modules.x86_64                                                                             4.18.0-348.el8                                                                        @System
kernel-modules.x86_64                                                                             4.18.0-477.21.1.el8_8                                                                 @rhel-8-baseos-rhui-rpms
kernel-tools.x86_64                                                                               4.18.0-477.21.1.el8_8                                                                 @rhel-8-baseos-rhui-rpms
kernel-tools-libs.x86_64                                                                          4.18.0-477.21.1.el8_8                                                                 @rhel-8-baseos-rhui-rpms
Available Packages
(中略)

kernel-core.x86_64                                                                                4.18.0-372.16.1.el8_6                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-372.19.1.el8_6                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-372.26.1.el8_6                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-372.32.1.el8_6                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-425.3.1.el8                                                                    rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-425.10.1.el8_7                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-425.13.1.el8_7                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-425.19.2.el8_7                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-477.10.1.el8_8                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-477.13.1.el8_8                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-477.15.1.el8_8                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-477.21.1.el8_8                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-477.27.1.el8_8                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-513.5.1.el8_9                                                                  rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-513.9.1.el8_9                                                                  rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-513.11.1.el8_9                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-513.18.1.el8_9                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-513.24.1.el8_9                                                                 rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-553.el8_10                                                                     rhel-8-baseos-rhui-rpms
kernel-core.x86_64                                                                                4.18.0-553.5.1.el8_10                                                                 rhel-8-baseos-rhui-rpms
(以下略)

```      

### kernelバージョンを指定してインストール

```
[root@ip- ~]# dnf -y install kernel*-4.18.0-513.11.1.el8_9
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.

Last metadata expiration check: 0:01:03 ago on Fri 07 Jun 2024 01:33:12 AM UTC.
Dependencies resolved.
==================================================================================================================================================================================================================
 Package                                             Architecture                    Version                                                            Repository                                           Size
==================================================================================================================================================================================================================
Installing:
 kernel                                              x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              10 M
 kernel-abi-stablelists                              noarch                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              10 M
 kernel-core                                         x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              43 M
 kernel-cross-headers                                x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              15 M
 kernel-debug                                        x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              10 M
 kernel-debug-core                                   x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              72 M
 kernel-debug-devel                                  x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              24 M
 kernel-debug-modules                                x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              65 M
 kernel-debug-modules-extra                          x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              11 M
 kernel-devel                                        x86_64                          4.18.0-513.11.1.el8_9                                              rhel-8-baseos-rhui-rpms                              24 M
 kernel-doc                                          noarch                          4.18.0-513.11.1.el8_9          
(中略)
Installed:
  bison-3.0.4-10.el8.x86_64                                               elfutils-libelf-devel-0.188-3.el8.x86_64                                flex-2.6.1-9.el8.x86_64
  kernel-4.18.0-513.11.1.el8_9.x86_64                                     kernel-abi-stablelists-4.18.0-513.11.1.el8_9.noarch                     kernel-core-4.18.0-513.11.1.el8_9.x86_64
  kernel-cross-headers-4.18.0-513.11.1.el8_9.x86_64                       kernel-debug-4.18.0-513.11.1.el8_9.x86_64                               kernel-debug-core-4.18.0-513.11.1.el8_9.x86_64
  kernel-debug-devel-4.18.0-513.11.1.el8_9.x86_64                         kernel-debug-modules-4.18.0-513.11.1.el8_9.x86_64                       kernel-debug-modules-extra-4.18.0-513.11.1.el8_9.x86_64
  kernel-devel-4.18.0-513.11.1.el8_9.x86_64                               kernel-doc-4.18.0-513.11.1.el8_9.noarch                                 kernel-headers-4.18.0-513.11.1.el8_9.x86_64
  kernel-modules-4.18.0-513.11.1.el8_9.x86_64                             kernel-modules-extra-4.18.0-513.11.1.el8_9.x86_64                       keyutils-libs-devel-1.5.10-9.el8.x86_64
  krb5-devel-1.18.2-25.el8_8.x86_64                                       libcom_err-devel-1.45.6-5.el8.x86_64                                    libkadm5-1.18.2-25.el8_8.x86_64
  libselinux-devel-2.9-8.el8.x86_64                                       libsepol-devel-2.9-3.el8.x86_64                                         libverto-devel-0.3.2-2.el8.x86_64
  m4-1.4.18-7.el8.x86_64                                                  make-1:4.2.1-11.el8.x86_64                                              openssl-devel-1:1.1.1k-9.el8_7.x86_64
  pcre2-devel-10.32-3.el8_6.x86_64                                        pcre2-utf16-10.32-3.el8_6.x86_64                                        pcre2-utf32-10.32-3.el8_6.x86_64
  perl-Carp-1.42-396.el8.noarch                                           perl-Data-Dumper-2.167-399.el8.x86_64                                   perl-Digest-1.17-395.el8.noarch
  perl-Digest-MD5-2.55-396.el8.x86_64                                     perl-Encode-4:2.97-3.el8.x86_64                                         perl-Errno-1.28-422.el8.x86_64
  perl-Exporter-5.72-396.el8.noarch                                       perl-File-Path-2.15-2.el8.noarch                                        perl-File-Temp-0.230.600-1.el8.noarch
  perl-Getopt-Long-1:2.50-4.el8.noarch                                    perl-HTTP-Tiny-0.074-3.el8.noarch                                       perl-IO-1.38-422.el8.x86_64
  perl-IO-Socket-IP-0.39-5.el8.noarch                                     perl-IO-Socket-SSL-2.066-4.module+el8.3.0+6446+594cad75.noarch          perl-MIME-Base64-3.15-396.el8.x86_64
  perl-Mozilla-CA-20160104-7.module+el8.3.0+6498+9eecfe51.noarch          perl-Net-SSLeay-1.88-2.module+el8.6.0+13392+f0897f98.x86_64             perl-PathTools-3.74-1.el8.x86_64
  perl-Pod-Escapes-1:1.07-395.el8.noarch                                  perl-Pod-Perldoc-3.28-396.el8.noarch                                    perl-Pod-Simple-1:3.35-395.el8.noarch
  perl-Pod-Usage-4:1.69-395.el8.noarch                                    perl-Scalar-List-Utils-3:1.49-2.el8.x86_64                              perl-Socket-4:2.027-3.el8.x86_64
  perl-Storable-1:3.11-3.el8.x86_64                                       perl-Term-ANSIColor-4.06-396.el8.noarch                                 perl-Term-Cap-1.17-395.el8.noarch
  perl-Text-ParseWords-3.30-395.el8.noarch                                perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch                            perl-Time-Local-1:1.280-1.el8.noarch
  perl-URI-1.73-3.el8.noarch                                              perl-Unicode-Normalize-1.25-396.el8.x86_64                              perl-constant-1.33-396.el8.noarch
  perl-interpreter-4:5.26.3-422.el8.x86_64                                perl-libnet-3.11-3.el8.noarch                                           perl-libs-4:5.26.3-422.el8.x86_64
  perl-macros-4:5.26.3-422.el8.x86_64                                     perl-parent-1:0.237-1.el8.noarch                                        perl-podlators-4.11-1.el8.noarch
  perl-threads-1:2.21-2.el8.x86_64                                        perl-threads-shared-1.58-2.el8.x86_64                                   zlib-devel-1.2.11-21.el8_7.x86_64

Complete!
[root@ip-~]#
```

### 再起動を行いkernelのバージョン確認

```
[root@ip- ~]# reboot
```
再起動後・・・

```
[root@ip- ~]# uname -r
4.18.0-513.11.1.el8_9.x86_64
[root@ip-~]# grubby --default-kernel
/boot/vmlinuz-4.18.0-513.11.1.el8_9.x86_64
[root@ip- ~]#
```


手動でバージョンアップを行うことができました