OpenStack: Installing a Linux Kernel Binary

Today I am going to talk about the Openstack in which I will talk about the installation of the Linux Kernel binary. There are some steps to follow and i will talk about first . 

Fig 1.1- Linus Kernel Installation

So below are the  steps install a Linux kernel binary from an RPM package:
  1. Run rpm with the –i option to install the new kernel. Do not use the –U option: You are installing a new kernel that has a different name than the old kernel; you are not upgrading the existing kernel.
  2. Make sure the new kernel works before you remove the old kernel. To verify the new kernel works, reboot the system using the new kernel. You might want to wait a while before removing the old kernel to make sure that no problems arise with the new one.
  3. When you are satisfied with the new kernel, remove the old kernel using rpm with the –e option; you must specify the kernel version number. If necessary, you can manually remove an old kernel by removing files whose names contain the release number from /boot or / (root). Remove information about the old kernel from grub.conf. Removing the kernel manually is not recommended because it is too easy to miss a file and because it does not remove the kernel from the RPM database.
Configurations

Check the current kernel version
root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Download a new kernel
[root@localhost ~]# curl http://mirror.centos.org/centos/7/os/x86_64/Packages/kernel-3.10.0-327.el7.x86_64.rpm > kernel-3.10.0-327.el7.x86_64.rpm

Check the files inside the RPM
[root@localhost ~]# rpm -qlp kernel-3.10.0-327.el7.x86_64.rpm | more
warning: kernel-3.10.0-327.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
/boot/.vmlinuz-3.10.0-327.el7.x86_64.hmac
/boot/System.map-3.10.0-327.el7.x86_64
/boot/config-3.10.0-327.el7.x86_64
/boot/initramfs-3.10.0-327.el7.x86_64.img
/boot/symvers-3.10.0-327.el7.x86_64.gz
/boot/vmlinuz-3.10.0-327.el7.x86_64
/etc/ld.so.conf.d/kernel-3.10.0-327.el7.x86_64.conf
/lib/modules/3.10.0-327.el7.x86_64
...

Install the new kernel
[root@localhost ~]# rpm -ivh kernel-3.10.0-327.el7.x86_64.rpm

5. Set the GRUB to boot from the new kernel
To list all the menu entries that will be displayed at system boot, issue the following command:
[root@localhost ~]# grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2
 CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
 CentOS Linux (3.10.0-229.el7.x86_64) 7 (Core)
 CentOS Linux (0-rescue-48a24f7c9ebc4f6590b8ce8f8a8e8f9c) 7 (Core)

The default entry is defined by the GRUB_DEFAULT line in the /etc/default/grub file. 

[root@localhost ~]# grep GRUB_DEFAULT /etc/default/grub
 GRUB_DEFAULT=saved

However, if the GRUB_DEFAULT line is set as saved, the parameter is stored in the /boot/grub2/grubenv file. It may be viewed by:

grub2-editenv list
 saved_entry=CentOS Linux (3.10.0-229.14.1.el7.x86_64) 7 (Core)

The /boot/grub2/grubenv file cannot be manually edited. Use the following command instead:

[root@localhost ~]# grub2-set-default 0
 [root@localhost ~]# grub2-editenv list
 saved_entry=0

Note that the first entry in the output of the awk command is index number 0.

Now reboot the system
Now please reboot the system and you are good to go with the complete configuration. Now lets verify the same below.

Verify
Verify that the new kernel is used
[root@localhost ~]# uname -a
 Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux