Linux Tactic

Mastering Kernel Updates in CentOS 7: A Step-by-Step Guide with ELRepo

How to Update the Kernel of CentOS 7

CentOS 7 is a Linux distribution that is widely used in server environments owing to its stability and security. If you’re using CentOS 7, you may need to update the kernel to enjoy the latest features and bug fixes.

Fortunately, updating the kernel of CentOS 7 is a straightforward process that can be accomplished using the ELRepo repository. This article provides step-by-step instructions on how to update the CentOS 7 kernel using the ELRepo repository and the Long Term Support (LTS) and Mainline Stable (MLS) kernels.

Preparing for the Kernel Upgrade

Before updating the CentOS 7 kernel, you need to make sure that your system is prepared for the upgrade. The following are the steps you should follow to prepare for the kernel upgrade.

Step 1: Install the ELRepo Repository

The ELRepo repository is a third-party repository that provides updated kernels for CentOS 7. To install the ELRepo repository, execute the following command in the terminal:

# rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Step 2: Update the System

After installing the ELRepo repository, the next step is to update your system by executing the following command in the terminal:

# yum update

This command updates your system with the latest packages, including the updated kernel.

Step 3: Reboot the System

After executing the yum update command, you need to reboot your system to apply the updates. Make sure that all your work is saved before proceeding with the reboot.

Installing Long Term Support Kernel

The Long Term Support kernel is a version of the CentOS 7 kernel that is supported for an extended period. This kernel is suitable for users who prioritize stability and security over the latest features and bug fixes.

Here are the steps involved in installing the Long Term Support kernel:

Step 1: Install the Long Term Support Kernel Package

To install the Long Term Support kernel, execute the following command in the terminal:

# yum –enablerepo=elrepo-kernel install kernel-lt

This command installs the Long Term Support kernel package from the ELRepo repository. Step 2: Set the Boot Option

After installing the Long Term Support kernel package, you need to set it as the default kernel by editing the GRUB configuration file.

To do this, execute the following command:

# grub2-set-default 0

This command sets the Long Term Support kernel as the default kernel. Step 3: Update the GRUB Configuration

After setting the default kernel, you need to update the GRUB configuration by executing the following command:

# grub2-mkconfig -o /boot/grub2/grub.cfg

This command updates the GRUB configuration to include the Long Term Support kernel.

Step 4: Reboot the System

After updating the GRUB configuration, you need to reboot your system to apply the changes. Make sure that all your work is saved before proceeding with the reboot.

Installing Mainline Stable Kernel

The Mainline Stable kernel is a version of the CentOS 7 kernel that provides the latest features and bug fixes. This kernel is suitable for users who prioritize the latest features and bug fixes over stability and security.

Here are the steps involved in installing the Mainline Stable kernel:

Step 1: Install the Mainline Stable Kernel Package

To install the Mainline Stable kernel, execute the following command in the terminal:

# yum –enablerepo=elrepo-kernel install kernel-ml

This command installs the Mainline Stable kernel package from the ELRepo repository. Step 2: Set the Boot Option

After installing the Mainline Stable kernel package, you need to set it as the default kernel by editing the GRUB configuration file.

To do this, execute the following command:

# grub2-set-default 0

This command sets the Mainline Stable kernel as the default kernel. Step 3: Update the GRUB Configuration

After setting the default kernel, you need to update the GRUB configuration by executing the following command:

# grub2-mkconfig -o /boot/grub2/grub.cfg

This command updates the GRUB configuration to include the Mainline Stable kernel.

Step 4: Reboot the System

After updating the GRUB configuration, you need to reboot your system to apply the changes. Make sure that all your work is saved before proceeding with the reboot.

Adding GPG Key for ELRepo

The GPG key is used to verify the authenticity and integrity of the packages in the ELRepo repository. To add the GPG key for the ELRepo repository, follow these steps:

Step 1: Download the GPG Key

To download the GPG key for the ELRepo repository, execute the following command in the terminal:

# rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

This command downloads the GPG key for the ELRepo repository and adds it to your system.

Step 2: Verify the GPG Key

After downloading the GPG key, you need to verify its authenticity. To do this, execute the following command:

# rpm -qi gpg-pubkey-$(echo $(gpg –throw-keyids < RPM-GPG-KEY-elrepo.org) | cut --characters=11-18) | grep "^Version"

This command verifies the version of the GPG key to ensure that it is the correct version.

Step 3: Update the System

After adding the GPG key for the ELRepo repository, you need to update your system by executing the following command in the terminal:

# yum update

This command updates your system with the latest packages, including the packages from the ELRepo repository.

Conclusion

Updating the kernel of CentOS 7 is a straightforward process that can be accomplished using the ELRepo repository. The Long Term Support kernel is suitable for users who prioritize stability and security, while the Mainline Stable kernel is suitable for users who prioritize the latest features and bug fixes.

Adding the GPG key for the ELRepo repository is necessary to ensure the authenticity and integrity of the packages in the repository. By following the steps provided in this article, you can easily update the kernel of your CentOS 7 system.

3) Adding ELRepo Repository to CentOS 7

CentOS 7 is a popular Linux distribution that is widely used in server environments for its stability and security. If you want to update your CentOS 7 system with the latest kernel updates, you can add the ELRepo repository to your system.

ELRepo is a third-party repository that provides updated kernels for CentOS 7. Heres how you can add the ELRepo repository to your CentOS 7 system.

Procedure to Add the ELRepo Repository

Step 1: Install the ELRepo Public Key

The first step for adding ELRepo to CentOS 7 is to install the ELRepo public key. The public key is used to verify the integrity of the packages that are downloaded from ELRepo.

The ELRepo public key can be downloaded using the rpm command, as shown below:

# rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

This command imports the GPG key used for package verification. Step 2: Download the ELRepo Repository File

After installing the ELRepo public key, the next step is to download the ELRepo repository file.

The file is in the RPM format and can be downloaded from the ELRepo website. The following command can be used to download the repository file:

# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

After downloading the repository file, the ELRepo repository will be added to the list of available repositories.

Step 3: Enable the ELRepo Repository

After downloading the ELRepo repository file, the next step is to enable the repository. This can be done using the following command:

# yum-config-manager –enable elrepo

This command enables the ELRepo repository on your system.

Step 4: Update Your System

After enabling the ELRepo repository, the next step is to update your system so that the new repositories are added and any updates are applied. This can be done using the following command:

# yum update

This command will download any updates from the new repositories that you just added.

Now that you have added the ELRepo repository to your CentOS 7 system, you can use it to install updated kernels.

4) Checking the Current Kernel Version on CentOS 7

The current kernel version is the version of the Linux kernel that is currently running on your system. Checking the current kernel version is useful when troubleshooting, administering, or updating your system.

Here are the steps for checking the current kernel version on CentOS 7.

Command to Check the Current Kernel Version on CentOS 7

To check the current kernel version on CentOS 7, use the following command:

# uname -r

This command displays the kernel version on your system in the following format:

3.10.0-1062.el7.x86_64

The output of this command indicates that the current kernel version running on your system is 3.10.0-1062.el7.x86_64. Note that this command only displays the kernel version and does not display any additional details regarding the kernel.

Conclusion

Adding the ELRepo repository to CentOS 7 is a straightforward process that enables you to install updated kernels on your system. After adding the ELRepo repository, you can use it to install updated kernels that provide the latest features, bug fixes, and security patches.

Checking the current kernel version using the uname command is useful when administering or troubleshooting your system, and it provides information about the kernel version that is running on your system.

5) Restarting CentOS 7 After Installing a New Kernel

After installing a new kernel on CentOS 7, it’s essential to restart your system so that the changes can take effect. Restarting your system will launch the new kernel and ensure that any updates or changes are applied.

Here are the steps you can follow to restart CentOS 7 after installing a new kernel.

Procedure to Restart CentOS 7 After Installing a New Kernel

Step 1: Check the GRUB Menu

After installing a new kernel, you should restart your system and check the GRUB menu. When your system restarts, the GRUB menu should automatically appear, allowing you to select which kernel version you want to use to boot your system.

Step 2: Select the New Kernel Version

Once the GRUB menu appears, you should select the new kernel version. Use the arrow keys on your keyboard to highlight the new kernel version, then press the enter key to boot using the new kernel.

Step 3: Boot into the New Kernel

After selecting the new kernel version, your system should begin the boot process using the new kernel. Wait until the boot process finishes and your system has fully started up.

You can verify that your system is running the new kernel version by running the following command:

# uname -r

This command displays the current kernel version running on your system. Step 4: Reboot Your System

After verifying that your system is running the new kernel version, you can safely reboot your system.

You can use the following command to reboot your system:

# reboot

This command restarts your system and ensures that the new kernel is fully launched and applied.

6) Selecting a Kernel Provided by Kernel-lt or Kernel-ml

When updating the kernel on CentOS 7, you have the option of selecting a kernel provided by the Kernel-lt or Kernel-ml repositories. The Kernel-lt repository provides a Long Term Support (LTS) version of the kernel, while the Kernel-ml repository provides a Mainline Stable (MLS) version of the kernel.

Heres a look at the difference between Kernel-lt and Kernel-ml, and how you can select a kernel provided by either repository.

Difference Between Kernel-lt and Kernel-ml

The Kernel-lt repository is designed to provide a stable and reliable version of the kernel. This version of the kernel is designed to provide long-term support, with bug fixes and security updates being regularly released for a long period.

The Kernel-lt repository is ideal for users who require a stable and reliable system. The Kernel-ml repository provides the latest version of the kernel.

This version of the kernel is designed to provide the latest features, bug fixes, and security updates. The Kernel-ml repository is ideal for users who need access to new features and bug fixes.

However, this version of the kernel may not be as stable as the LTS version.

Procedure to Select a Kernel Provided by Kernel-lt or Kernel-ml

To select a kernel provided by either Kernel-lt or Kernel-ml, follow these steps:

Step 1: Install the Kernel Package

To install a kernel provided by Kernel-lt or Kernel-ml, execute the following command in the terminal:

# yum –enablerepo=elrepo-kernel install kernel-lt (or kernel-ml)

This command installs the kernel package from the Kernel-lt or Kernel-ml repository. Step 2: Set the Boot Option

After installing the kernel package, you need to set it as the default kernel by editing the GRUB configuration file.

To do this, execute the following command:

# grub2-set-default 0

This command sets the Kernel-lt or Kernel-ml kernel as the default kernel. Step 3: Update the GRUB Configuration

After setting the default kernel, you need to update the GRUB configuration by executing the following command:

# grub2-mkconfig -o /boot/grub2/grub.cfg

This command updates the GRUB configuration to include the Kernel-lt or Kernel-ml kernel.

Step 4: Reboot the System

After updating the GRUB configuration, you need to reboot your system to apply the changes. Make sure that all your work is saved before proceeding with the reboot.

Conclusion

Restarting CentOS 7 after updating the kernel is a crucial step, and it ensures that any changes or updates are fully applied to your system. Selecting a kernel provided by either Kernel-lt or Kernel-ml depends on your requirements for stability and latest features and bug fixes.

By following these steps, you can easily select and install a kernel provided by Kernel-lt or Kernel-ml on your CentOS 7 system.

7) Verifying Kernel Update on CentOS 7

After updating the kernel on CentOS 7, it is important to verify that the update was successful and that the new kernel version is running on your system. Verifying the kernel update ensures that any new features, bug fixes, and security patches included in the update are applied to your CentOS 7 system.

Here’s how you can verify a kernel update on CentOS 7.

Command to Verify Kernel Update on CentOS 7

To verify the kernel update on CentOS 7, you can use the “uname” command. This command displays system information, including the kernel version.

Follow the steps below to check the new kernel version on your CentOS 7 system. Step 1: Open a Terminal

To begin, open a terminal on your CentOS 7 system.

You can do this by clicking on the “Applications” menu, navigating to the “System Tools” or “Utilities” section, and selecting the “Terminal” application. Step 2: Run the “uname” Command

In the terminal, enter the following command:

$ uname -r

This command retrieves and displays the current kernel version running on your CentOS 7 system.

The “-r” option specifically instructs the “uname” command to display only the kernel release version. Step 3: Verify the Kernel Version

After executing the command, the output will display the kernel version information.

It usually appears in the following format:

3.10.0-1062.4.3.el7.x86_64

In this example, “3.10.0-1062.4.3.el7.x86_64” is the kernel version. The first part indicates the kernel series (3.10.0), followed by the specific release version (-1062.4.3.el7).

The “el7” part indicates that the kernel is built for CentOS 7. If the displayed kernel version matches the updated version you intended to install, it means that the kernel update was successful, and the new kernel is now running on your CentOS 7 system.

You can now benefit from any new features, bug fixes, and security patches that the update brings. Note: It is important to keep in mind that after updating the kernel, the new version may not necessarily be the default version used by your system.

If the currently running kernel is not the updated version you desire, you may need to restart your system and select the updated kernel during the boot process. Refer to the previous section on restarting CentOS 7 after installing a new kernel for instructions on how to do this.

Verifying the kernel update on CentOS 7 is an important step to ensure that the new kernel version is running and active on your system. The “uname” command provides a simple and quick way to check the kernel version.

By following the steps outlined in this article, you can easily verify the kernel update and confirm that your CentOS 7 system is running the desired kernel version with all the associated improvements. In conclusion, updating the kernel of CentOS 7 is a vital task that ensures system stability, security, and access to new features.

By following the straightforward procedures outlined in this article, including adding the ELRepo repository, selecting between the Long Term Support (LTS) and Mainline Stable (MLS) kernels, and verifying the kernel update using the “uname” command, users can easily enhance their CentOS 7 systems. Whether prioritizing stability with the LTS kernel or seeking the latest features and bug fixes with the MLS kernel, CentOS 7 users can customize their kernel selections to meet their specific needs.

By staying informed about kernel updates and executing them effectively, users can optimize performance and security on their CentOS 7 systems.

Popular Posts