RHEL Kernel/OS version update using local repos

 //current running version

[root@rhel8_1 boobi]# cat /etc/redhat-release

Red Hat Enterprise Linux release 8.1 (Ootpa)


//add rhel8.4 image on vm
[root@rhel8_1 boobi]# blkid
/dev/nvme0n1p1: UUID="b8df1d58-4f59-40b2-b7c1-4cfd8967f305" TYPE="xfs" PARTUUID="b0ea7cd3-01"
/dev/nvme0n1p2: UUID="46864922-c014-42a2-8ac3-913c59fce6cf" TYPE="swap" PARTUUID="b0ea7cd3-02"
/dev/nvme0n1p3: UUID="680a7d20-8d0e-4f33-ba0a-bb9696e1eb0d" TYPE="xfs" PARTUUID="b0ea7cd3-03"
/dev/sr1: UUID="2021-05-03-15-21-56-00" LABEL="RHEL-8-4-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="426eea3b" PTTYPE="dos"

//mount the iso
[root@rhel8_1 boobi]# mount /dev/sr1 /mnt/rhel_iso/
mount: /mnt/rhel_iso: WARNING: device write-protected, mounted read-only.

[root@rhel8_1 boobi]# ls /mnt/rhel_iso/
AppStream  BaseOS  EFI  EULA  extra_files.json  GPL  images  isolinux  media.repo  RPM-GPG-KEY-redhat-beta  RPM-GPG-KEY-redhat-release  TRANS.TBL

//copy the files
[root@rhel8_1 boobi]# mkdir /tmp/rhel8.4_image
[root@rhel8_1 boobi]# cp -pRf /mnt/rhel_iso/ /tmp/rhel8.4_image/


//create local repos
[root@rhel8_1 boobi]# vi /etc/yum.repos.d/rhel8.4.repo
[BaseOS]
name=RHEL8.4Base
baseurl=file:///tmp/rhel8.4_image/rhel_iso/BaseOS
enabled=1
gpgcheck=0

[AppStream]
name=RHEL8.4Apps
baseurl=file:///tmp/rhel8.4_image/rhel_iso/AppStream
enabled=1
gpgcheck=0

[root@rhel8_1 boobi]# yum repolist
Updating Subscription Management repositories.
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
RHEL8.4Base                                                                                                                  6.6 MB/s | 2.3 MB     00:00
RHEL8.4Apps                                                                                                                   32 MB/s | 6.8 MB     00:00
Last metadata expiration check: 0:00:01 ago on Fri 30 Jul 2021 02:16:43 AM PDT.
repo id                                                                   repo name                                                                    status
AppStream                                                                 RHEL8.4Apps                                                                  5,151
BaseOS                                                                    RHEL8.4Base                                                                  1,707


//kernel upgrade
[root@rhel8_1 boobi]# df -h /boot/     //here the kernel was installed before upgrade make the size is available
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1  295M  153M  143M  52% /boot

[root@rhel8_1 boobi]# uname -a
Linux rhel8_1.boobi.com 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[root@rhel8_1 boobi]# uname -r
4.18.0-147.el8.x86_64

[root@rhel8_1 boobi]# rpm -qa | grep kernel
abrt-addon-kerneloops-2.10.9-11.el8.x86_64
kernel-modules-4.18.0-147.el8.x86_64
kernel-core-4.18.0-147.el8.x86_64
kernel-tools-libs-4.18.0-147.el8.x86_64
kernel-4.18.0-147.el8.x86_64
kernel-tools-4.18.0-147.el8.x86_64
kernel-devel-4.18.0-147.el8.x86_64
kernel-headers-4.18.0-147.el8.x86_64

[root@rhel8_1 boobi]# yum --security update    //here subscription is missing hence kernel update is not avaliable
Updating Subscription Management repositories.
This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
Last metadata expiration check: 0:02:38 ago on Fri 30 Jul 2021 02:16:43 AM PDT.
No security updates needed, but 828 updates available
Dependencies resolved.
Nothing to do.
Complete!

// but kernel upgrade is available on BaseOS repository when type "yum update" it will bring the latest rhel 8.4 kernel update shown below

//version upgrade

[root@rhel8_1 boobi]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 (Ootpa)

[root@rhel8_1 boobi]# uname -r
4.18.0-147.el8.x86_64

[root@rhel8_1 boobi]# yum update //it shows latest kernel according to 8.4 image

[root@rhel8_1 boobi]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)

//OS version has been changed 8.1 to 8.4

//kernel still showing previous version, need to reboot.
[root@rhel8_1 boobi]# uname -r
4.18.0-147.el8.x86_64

[root@rhel8_1 boobi]# init 6

[root@rhel8_1 boobi]# uname -r
4.18.0-305.el8.x86_64

//now the kernel updated, as well during booting the grup listed two line one existing kernel and one new kernel

[root@rhel8_1 boobi]# df -h /boot/
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1  295M  215M   81M  73% /boot

[root@rhel8_1 boobi]# rpm -qa | grep kernel
kernel-modules-4.18.0-305.el8.x86_64
kernel-devel-4.18.0-305.el8.x86_64
abrt-addon-kerneloops-2.10.9-20.el8.x86_64
kernel-devel-4.18.0-147.el8.x86_64
kernel-core-4.18.0-305.el8.x86_64
kernel-core-4.18.0-147.el8.x86_64
kernel-4.18.0-147.el8.x86_64
kernel-4.18.0-305.el8.x86_64
kernel-modules-4.18.0-147.el8.x86_64
kernel-tools-libs-4.18.0-305.el8.x86_64
kernel-headers-4.18.0-305.el8.x86_64
kernel-tools-4.18.0-305.el8.x86_64

//now you can remove old kernel to make sure the boot space available

Testing possibilities
1. remove previous kernel
[root@rhel8_1 boobi]# rpm -qa | grep kernel
[root@rhel8_1 boobi]# yum remove kernel-4.18.0-147.el8.x86_64
[root@rhel8_1 boobi]# yum remove kernel-modules-4.18.0-147.el8.x86_64 kernel-devel-4.18.0-147.el8.x86_64 kernel-core-4.18.0-147.el8.x86_64

//now reboot and check
//now during booting it showing only the latest kernel list only on grub and booted successfully

2. revert the update and run previous kernel

[root@rhel8_1 boobi]# yum history
Updating Subscription Management repositories.

This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.


ID     | Command line              | Date and time    | Action(s)      | Altered
--------------------------------------------------------------------------------
     2 | update                    | 2021-07-30 02:27 | I, O, U        |  890 EE
     1 |                           | 2021-07-30 00:45 | Install        | 1391 EE

//here id - 2 is the update operation we did for OS version and kernel upgrade process, we can revert this id

[root@rhel8_1 boobi]# yum history undo 2



Post a Comment

0 Comments