Kernel is the central component of an Operating System which is responsible for memory, process, and task and disk management. The first thing you need to think about updating a kernel is that “why do you need a kernel update”. Many people think about updating kernel for the vulnerabilities that may not get fixed by updating the kernel. Kernel update is required only if,
• You have installed newer hardware that wasn't previously supported.
• Drivers for the hardware you do have are updated and you need to use them.
• Most Important: Security holes have been found in earlier kernels and are fixed in the latest kernel.
We can now see how to install/update the current redhat kernel RPM.
1. Note down the current kernel installed packages
First, you need to check (and note down) the current RPM kernel packages that are currently installed in the server. This can be checked using rpm command.
# rpm –qa | grep ‘kernel’
Also check for the following packages for SMB kernels.
# rpm -q mkinitrd SysVinit initscripts
These commands will give the package names of the ones installed in your server.
2. Download the latest RPMs
Now, you need to download the latest kernel RPMs from ftp://updates.redhat.com or from any mirror sites. Download all kernel-* rpms.
3. Confirming the Downloaded RPM
Before proceeding with the RPM installation/update, you need to verify that the RPMs were downloaded properly. Sometimes you may finish downloading with corrupted RPMs. So, in order to make the kernel update successful, you need to confirm the loaded RPMs md5 sum using the following command (on redhat 5.x machines).
# rpm -K --nopgp *rpm
If all the MD5 sums are showing “OK”, you are fine to proceed.
It is always recommended to have a boot disk in hand while proceeding with kernel upgrade as you may ended up with a non-bootable machine in case of any unsuccessful kernel update.
4. Install/Update kernel RPMs
First you need to update the non-kernel RPMs like, mkinitrd, SysVinit and initscripts. Following command will do this installation.
rpm -Uvh mkinitrd*rpm SysVinit*rpm initscripts*rpm
The following packages are optional which are needed only for kernel developers.
# rpm -Uvh kernel-headers*rpm kernel-source*rpm
Now, we can proceed with the kernel and module package update. Please note that, we need to use -i (install) option rather than –U (update). Because –U option will delete the previously installed kernel version which we may need in case of any unsuccessful update.
# rpm -ivh kernel-2.2.17-14.i586.rpm kernel-ibcs*rpm kernel-pcmcia-cs-*rpm
Replace the version with the exact ones you are installing.
5. Creating Initial RAM disk
This step is required if your system has SCSI controllers/SCSI hard drives. If your system has SCSI controllers, you will be able to find initrd images in /boot.
# ls –l /boot/initrd-*
If you can find initrd image for currently running kernel, you need to proceed with this step for creating new initrd image for the new kernel.
# mkinitrd /boot/initrd-2.2.17-14.img 2.2.17-14
This will create the RAM image “/boot/initrd-2.2.17-14.img “.
6. Verify the grub configuration
Grub will be automatically configured with the new kernel upon RPM installation. A sample grub configuration file - /etc/grub.conf’ - will be as follows.
title Red Hat Linux (2.2.17-14)
kernel /vmlinuz-2.2.17-14 ro root=/dev/sdb6
The value “0” to “default” indicates that it will boot from the first kernel mentioned in grub.conf.
7. Reboot the machine
Now, you can reboot the machine using the following command.
shutdown -r now
The system will be start up with the new kernel.
You might also like
Filed Under : LINUX HOWTO