Search This Blog

Tuesday, March 15, 2016

RHEL6 - Updating Kernel

We all know how important it is to keep up with the patching process on our systems. It prevents people from breaking in and doing malicious things, not to mention it keeps the boss from yelling at us, too! To update the kernel package in Red Hat is fairly straightforward.
Step 1. View the current version of the kernel:
# uname -r
2.6.32-71.el6.x86_64

you can use the yum command to query information about packages in the repository. You know from the preceding output that you are using version 71 of the kernel on Red Hat Enterprise Linux 6. You can check to see what information the yum command can provide on the most recent version of the kernel package in the repositories.

Step 2. To view kernel package information, use the following command:
# yum info kernel
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Installed Packages
Name : kernel
Arch : x86_64
Version : 2.6.32
Release : 71.el6
Size : 112 M
Repo : installed
From repo : anaconda-RedHatEnterpriseLinux-201009221801.x86_64
Summary : The Linux kernel
URL : http://www.kernel.org/
License : GPLv2
Description: The kernel package contains the Linux kernel (vmlinuz), the core of any
    : Linux operating system. The kernel handles the basic functions
    : of the operating system: memory allocation, process allocation, device
    : input and output, etc.


How to update kernel in RHEL 6, Detail procedure is below

Step 1. On Client01, query the version of the kernel via the package manager:
[root@server2 Desktop]# yum info kernel
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Installed Packages
Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.el6
Size        : 126 M
Repo        : installed
From repo   : anaconda-RedHatEnterpriseLinux-201507020259.x86_64
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.12.1.el6
Size        : 126 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Available Packages
Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.18.1.el6
Size        : 30 M
Repo        : rhel-x86_64-server-6
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

The first thing you should notice is the additional section that shows available packages alongside the currently installed package. The first half of the output shows the installed package, and the second half shows the kernel package available for you to upgrade to. Because you are only on version 573.el6 and the latest version is 573.18.1.el6, you should upgrade the kernel.

Step 2. Using the package manager, you can upgrade the kernel to the latest version:
[root@server2 Desktop]# yum update -y kernel
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:2.6.32-573.18.1.el6 will be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-573.18.1.el6 for package: kernel-2.6.32-573.18.1.el6.x86_64
--> Running transaction check
---> Package kernel-firmware.noarch 0:2.6.32-573.12.1.el6 will be updated
---> Package kernel-firmware.noarch 0:2.6.32-573.18.1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                  Arch                                            Version                                                        Repository                                                     Size
=============================================================================================================================================================================================================================================
Installing:
 kernel                                                   x86_64                                          2.6.32-573.18.1.el6                                            rhel-x86_64-server-6                                           30 M
Updating for dependencies:
 kernel-firmware                                          noarch                                          2.6.32-573.18.1.el6                                            rhel-x86_64-server-6                                           18 M

Transaction Summary
=============================================================================================================================================================================================================================================
Install       1 Package(s)
Upgrade       1 Package(s)

Total download size: 48 M
Downloading Packages:
(1/2): kernel-2.6.32-573.18.1.el6.x86_64.rpm                                                                                                                                                                          |  30 MB     00:57    
(2/2): kernel-firmware-2.6.32-573.18.1.el6.noarch.rpm                                                                                                                                                                 |  18 MB     00:58    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                        409 kB/s |  48 MB     02:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : kernel-firmware-2.6.32-573.18.1.el6.noarch                                                                                                                                                                                1/3
  Installing : kernel-2.6.32-573.18.1.el6.x86_64                                                                                                                                                                                         2/3
  Cleanup    : kernel-firmware-2.6.32-573.12.1.el6.noarch                                                                                                                                                                                3/3
  Verifying  : kernel-firmware-2.6.32-573.18.1.el6.noarch                                                                                                                                                                                1/3
  Verifying  : kernel-2.6.32-573.18.1.el6.x86_64                                                                                                                                                                                         2/3
  Verifying  : kernel-firmware-2.6.32-573.12.1.el6.noarch                                                                                                                                                                                3/3

Installed:
  kernel.x86_64 0:2.6.32-573.18.1.el6                                                                                                                                                                                                        

Dependency Updated:
  kernel-firmware.noarch 0:2.6.32-573.18.1.el6                                                                                                                                                                                               

Complete!

[root@server2 Desktop]# yum info kernel
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Installed Packages
Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.el6
Size        : 126 M
Repo        : installed
From repo   : anaconda-RedHatEnterpriseLinux-201507020259.x86_64
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.12.1.el6
Size        : 126 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Name        : kernel
Arch        : x86_64
Version     : 2.6.32
Release     : 573.18.1.el6
Size        : 126 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : The Linux kernel
URL         : http://www.kernel.org/
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Now you should have the most updated version of your kernel on Client01. By using the yum command to update the kernel, you are pulling only the most updated version that Red Hat is making available through the repositories. This doesn’t mean that this is the most recent version of the Linux kernel available. If you visit http://www.kernel.org, you can find the most up-to-date kernel available. You should download it in a format you are comfortable using (the site has .tar, .gz, .rpm, and more). If you are going to use an .rpm file, remember that you have the rpm command to make installation easier for you. As an example, I pulled the most recent version of the kernel from Red Hat as an .rpm file for the Client01 system.

Instead of using the package manager to install the kernel from the repository, as I did, you could also do the following:
# rpm -ivh kernel-2.6.18-194.3.1el5

WARNING
When updating a kernel with the rpm command, never use the -U option to update.
The reason behind this is that the update option erases the prior kernel when updating, whereas the -i option installs the newer kernel alongside the old kernel. If something doesn’t work or goes wrong, you have an older kernel to revert to.
You’ve been warned!

Regardless of what method you use, when the update of the kernel is complete, you should verify that /boot/grub/grub.conf has been updated to contain a stanza with the updated kernel and that it is set to boot from it. This should happen automatically when updating the kernel via the package manager; however, I recommend that you always verify this for yourself (otherwise, your system may boot incorrectly).

Since the kernel hasn’t changed on RHEL01 (because it was already up-to-date), look at the grub.conf file on Client01 because you did update the kernel there:
[root@server2 getPackage]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_server2-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-573.18.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-573.18.1.el6.x86_64 ro root=/dev/mapper/vg_server2-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg_server2/lv_swap rd_LVM_LV=vg_server2/lv_root rd_NO_DM rhgb quiet crashkernel=auto
        initrd /initramfs-2.6.32-573.18.1.el6.x86_64.img
title Red Hat Enterprise Linux Server (2.6.32-573.12.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-573.12.1.el6.x86_64 ro root=/dev/mapper/vg_server2-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg_server2/lv_swap rd_LVM_LV=vg_server2/lv_root rd_NO_DM rhgb quiet crashkernel=auto
        initrd /initramfs-2.6.32-573.12.1.el6.x86_64.img
title Red Hat Enterprise Linux 6 (2.6.32-573.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-573.el6.x86_64 ro root=/dev/mapper/vg_server2-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 rd_LVM_LV=vg_server2/lv_swap rd_LVM_LV=vg_server2/lv_root rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-573.el6.x86_64.img

You can see that the first entry is the newly updated kernel and that the default option is set to 0, making sure you will load your updated kernel the next time you boot the system. Reboot your system to allow the new kernel to be used and check to make sure that there are no errors or issues when booting up with the new kernel.
If you encounter any issues, you can reboot again and choose the older kernel at the GRUB boot menu to fix any issues 
you’re having.



Thank you for reading.

For Reading other article, visit to “https://sites.google.com/site/unixwikis/

No comments:

Post a Comment