Update Kernel Package2 - 1458767332 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

L­­ive!

Lab

Updating the
Kernel
Contents Related Courses

Introduction 1
Red Hat CSA 7
Determining the Kernel 1

Obtaining the New Kernel 1


Related Videos
Downloading the Kernel 1

Booting Different Kernels 2


Update the
Kernel Package
Appropriately to
Ensure a Bootable
System

Need Help?

Linux Academy
Community

... and you can


always send in a
support ticket on
our website to talk
to an instructor!

Lab Connection Information


• Labs may take up to five minutes to build
• The IP address of your server is located on the Live!
Lab page
• Username: linuxacademy
• Password: 123456
• Root Password: 123456
Updating the Kernel Linux Academy

Introduction
While in most instances, you can update your Red Hat system’s kernel with yum, downloading and installing
the latest kernel using RPM is an alternative method for keeping your kernel up-to-date.

Note
This process can also be used to install a custom kernel on the system. Red Hat does not
consider any “Red Hat” systems running a custom kernel a Red Hat system.

Start the Live! Lab, and then SSH into your server with the given credentials. We need to work as root to
update the kernel. You can also prepend sudo to any commands if working as a superuser.

Determining the Kernel


Use the unamecommand to view information regarding your system. In particular, we want to use the
uname -r command, which outputs the kernel release number:

[root@linuxacademy1 ~]# uname -r


3.10.0-123.8.1.el7.x86_64

Your results should be similar, if not identical. The kernel 3.10.0-123.8.1.el7.x86_64 is the default kernel in
this lab. If running on an outside server, your results may differ.

Obtaining the New Kernel


Now that you are aware of the kernel version run yum list kernel to see if there are any available kernel
updates. When run, you may receive a notification stating that the repodata is out-of-date. To solve this, run
yum clean all and then re-run the previous command:

[root@linuxacademy1 ~]# yum clean all


[root@linuxacademy1 ~]# yum list kernel

The output now lists a newer, updated kernel, currently 3.10.0-327.4.5.el7, although yours may be newer.

Downloading the Kernel


We can download the RPM of the new kernel through the use of yumdownloader. Run:

-1-
Updating the Kernel Linux Academy

[root@linuxacademy1 ~]# yumdownloader kernel

And install:

[root@linuxacademy1 ~]# rpm -ivh kernel-3.10.0-327.4.5.el7.x86_64.rpm

The name of your kernel package may vary. At this point you may realize, upon running the above command,
you receive an error relating to failed dependencies. To resolve this, we need to update our linux-firmware
and dracut packages:

[root@linuxacademy1 ~]# yum install linux-firmware dracut

With the dependencies resolved, rerun the installation command.

If you now navigate to the /boot directory, you can view the newest kernel installed under vmlinuz-3.10.0-
327.4.5.el7.x86_64. You can also see the older kernel located alongside it.

If vmlinuz-3.10.0-327.4.5.el7.x86_64 is not located in the /boot directory, run dracut to regenerate it for
the latest kernel.

Ensure the new kernel is installed by rebooting the system and once more running the uname -r command.
It should output the version number of the newly-downloaded kernel.

Booting Different Kernels


Through the use of the GRUB bootloader, we can designate from which kernel we want to boot. Those of
you who use Linux in a desktop environment may already be familiar with the GRUB boot menu, and may
be wondering how we can use GRUB when our Linux Academy lab servers do not bring up boot menu
upon login. We do this by altering which kernel we use through the command line.

Run yum list kernel to view a list of available kernels. Both our old and new kernels are available.

To change the default kernel, we use the grub2-set-default command followed by a number, 0 denotes
newer kernel, 1 the older.

Run:

[root@linuxacademy1 ~]# grub2-set-default 1

Then reboot. Should you run uname -r once more, you should see that we are using the older kernel. To
change back replace the 1 in the above code with a 0, rerun the command, and reboot the system.

-2-

You might also like