CentOS 7 upgrades the latest kernel

View kernel

uname -r

Set kernel source

Mainly http://elrepo.org/tiki/tiki-index.php

The ELRepo warehouse is a community-based Enterprise Linux warehouse that provides support for Red Hat Enterprise (RHEL) and other RHEL based Linux distributions (CentOS, Scientific, Fedora, etc.).
ELRepo focuses on software packages related to hardware, including file system driver, video card driver, network driver, sound card driver and camera driver.

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

View available system kernel packages

yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

4.4 and 5.0 can be used

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * elrepo-kernel: hkg.mirror.rackspace.com
elrepo-kernel                                                                                                                                                        | 2.9 kB  00:00:00
elrepo-kernel/primary_db                                                                                                                                             | 1.8 MB  00:00:00
Available Packages
kernel-lt.x86_64                                                                              4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-devel.x86_64                                                                        4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-doc.noarch                                                                          4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-headers.x86_64                                                                      4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-tools.x86_64                                                                        4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-tools-libs.x86_64                                                                   4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                                             4.4.176-1.el7.elrepo                                                             elrepo-kernel
kernel-ml.x86_64                                                                              5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-devel.x86_64                                                                        5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-doc.noarch                                                                          5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-headers.x86_64                                                                      5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools.x86_64                                                                        5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools-libs.x86_64                                                                   5.0.3-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                                             5.0.3-1.el7.elrepo                                                               elrepo-kernel
perf.x86_64                                                                                   5.0.3-1.el7.elrepo                                                               elrepo-kernel
python-perf.x86_64                                                                            5.0.3-1.el7.elrepo 

Install the latest kernel

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

Setting kernel

Update kernel

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

output

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.3-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.0.3-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.10.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.10.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-5167da7ac6324a6ab3e83847762d2dec
Found initrd image: /boot/initramfs-0-rescue-5167da7ac6324a6ab3e83847762d2dec.img
done

View system kernel

cat /boot/grub2/grub.cfg |grep menuentry
if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
  menuentry_id_option=""
export menuentry_id_option
menuentry 'CentOS Linux (5.0.3-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-5.0.3-1.el7.elrepo.x86_64-advanced-56e38f49-df2a-4a33-833f-90b308aa61de' {
menuentry 'CentOS Linux (3.10.0-957.10.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.10.1.el7.x86_64-advanced-56e38f49-df2a-4a33-833f-90b308aa61de' {
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-56e38f49-df2a-4a33-833f-90b308aa61de' {
menuentry 'CentOS Linux (0-rescue-5167da7ac6324a6ab3e83847762d2dec) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-5167da7ac6324a6ab3e83847762d2dec-advanced-56e38f49-df2a-4a33-833f-90b308aa61de' {

Setting kernel

Copy the kernel CentOS Linux (5.0.3-1.el7.elrepo.x86_) 7 (core) to be set first
Set default kernel

grub2-set-default "CentOS Linux (5.0.3-1.el7.elrepo.x86_64) 7 (Core)"

Verification

grub2-editenv list 

Reset computer

reboot

Verify kernel

uname -r

output

5.0.3-1.el7.elrepo.x86_64

Reference resources
http://elrepo.org/tiki/tiki-index.php
https://blog.csdn.net/kikajack/article/details/79396793
https://blog.csdn.net/cacacai/article/details/79727218

Keywords: Linux CentOS RPM RHEL

Added by teamshultz on Tue, 03 Dec 2019 19:39:30 +0200