CentOS7.5-1804 system kernel upgrade

Copyright statement: This article is an original article of hard work, and all major self-media platforms are updated simultaneously. Welcome to reprint, please indicate the source, thank you

1. Background#

According to the official Linux website (https://www.kernel.org), the latest Linux kernel is 4.19, but the kernel version in the latest version of Redhat is still 3.10.*, which is obviously behind many versions. Some software has requirements for the system kernel version, so we need to upgrade the system kernel to the specified version (RPM download address: https://elrepo.org/linux/kernel). This article is upgraded to the latest kernel version. In CentOS, ELRope is the most widely used source.

2. Operation steps#

  1. Configure the ELRepo repository.
[ root@gysl ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[ root@gysl ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Get http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Get http://elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
preparing...                          ################################# [100%]
upgrading/installation...1:elrepo-release-7.0-3.el7.elrepo  ################################# [100%]
  1. List the Kernel and related components that can be installed.
[ root@gysl ~]# yum --disablerepo="*"--enablerepo="elrepo-kernel" list available
Loaded plugin: fastestmirror
Determining fastest mirrors
 * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
elrepo-kernel                                                                                                                                                         |2.9 kB  00:00:00     
elrepo-kernel/primary_db                                                                                                                                              |1.8 MB  00:00:02     
Installable packages
kernel-lt.x86_64                                                                              4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-devel.x86_64                                                                        4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-doc.noarch                                                                          4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-headers.x86_64                                                                      4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-tools.x86_64                                                                        4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-tools-libs.x86_64                                                                   4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                                             4.4.162-1.el7.elrepo                                                              elrepo-kernel
kernel-ml.x86_64                                                                              4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-devel.x86_64                                                                        4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-doc.noarch                                                                          4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-headers.x86_64                                                                      4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools.x86_64                                                                        4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools-libs.x86_64                                                                   4.19.0-1.el7.elrepo                                                               elrepo-kernel
kernel-ml-tools-libs-devel.x86_64                                                             4.19.0-1.el7.elrepo                                                               elrepo-kernel
perf.x86_64                                                                                   4.19.0-1.el7.elrepo                                                               elrepo-kernel
python-perf.x86_64                                                                            4.19.0-1.el7.elrepo                                                               elrepo-kernel
  1. Install the latest version of the kernel. Kernel-ml is the Mainline version (it=long-term). This version of the kernel will introduce all new features. The new Mainline kernel is released every 2-3 months.
[ root@gysl ~]# yum --enablerepo=elrepo-kernel install kernel-ml -y
Loaded plugin: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * elrepo: mirrors.tuna.tsinghua.edu.cn
 * elrepo-kernel: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                                                                  |3.6 kB  00:00:00     
elrepo                                                                                                                                                                |2.9 kB  00:00:00     
extras                                                                                                                                                                |3.4 kB  00:00:00     
updates                                                                                                                                                               |3.4 kB  00:00:00(1/3): extras/7/x86_64/primary_db                                                                                                                                     |204 kB  00:00:01(2/3): updates/7/x86_64/primary_db                                                                                                                                    |6.0 MB  00:00:07(3/3): elrepo/primary_db                                                                                                                                              |530 kB  00:00:07     
Resolving dependencies
- - > Checking transaction
- - - > Package kernel-ml.x86_64.0.4.19.0-1.el7.elrepo will be installed
- - > Resolve dependencies complete

Dependency resolution

=============================================================================================================================================================================================
 Package architecture version source size
=============================================================================================================================================================================================
Installing:
 kernel-ml                                 x86_64                                 4.19.0-1.el7.elrepo                                    elrepo-kernel                                  46 M

Business summary
=============================================================================================================================================================================================
Install 1 package

Total downloads: 46 M
Installation size: 205 M
Downloading packages:
kernel-ml-4.19.0-1.el7.elrepo.x86_64.rpm                                                                                                                          |46 MB  00:01:54     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: The RPM database has been modified by a non-yum program.
 Installing: kernel-ml-4.19.0-1.el7.elrepo.x86_64                           1/1 
 Verifying: kernel-ml-4.19.0-1.el7.elrepo.x86_64                                                                                                                                     1/1 
Installed:
 kernel-ml.x86_64 0:4.19.0-1.el7.elrepo                                                                                                                                                     
complete!
[ root@gysl ~]# reboot
  1. After restarting the system, manually select the new kernel. If the following content appears, the upgrade is successful.

  1. Log in to the system to view relevant system information.
[ root@gysl ~]# hostnamectl 
 Static hostname: gysl
   Icon name: computer-vm
   Chassis: vm
  Machine ID: ec3aaeb5faad4f0dbe7121416e9af1c8
   Boot ID: 66ff8175b82641328795dbf951c63d7a
 Virtualization: vmware
 Operating System: CentOS Linux 7(Core)
  CPE OS Name: cpe:/o:centos:centos:7
   Kernel: Linux 4.19.0-1.el7.elrepo.x86_64
  Architecture: x86-64[root@gysl ~]# uname -sr
Linux 4.19.0-1.el7.elrepo.x86_64
[ root@gysl ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804(Core)
  1. Set the new kernel as the default boot kernel and create a configuration file for the new kernel. The default startup sequence should be 1, the kernel is inserted to the front after the upgrade, and the value is 0 (if you need to manually select which kernel each time you start, this step can be omitted)
[ root@gysl ~]# grub2-set-default0[root@gysl ~]# grub2-mkconfig -o /etc/grub2.cfg 
Generating grub configuration file ...
Found linux image:/boot/vmlinuz-4.19.0-1.el7.elrepo.x86_64
Found initrd image:/boot/initramfs-4.19.0-1.el7.elrepo.x86_64.img
Found linux image:/boot/vmlinuz-3.10.0-862.el7.x86_64
Found initrd image:/boot/initramfs-3.10.0-862.el7.x86_64.img
Found linux image:/boot/vmlinuz-0-rescue-ec3aaeb5faad4f0dbe7121416e9af1c8
Found initrd image:/boot/initramfs-0-rescue-ec3aaeb5faad4f0dbe7121416e9af1c8.img
done
  1. The installation command automatically prompts the package. This step is only mentioned for the convenience of use and is not a necessary step. After installing this package, you can further prompt after typing the command. For example, after typing systemctl, press Tab to build to further prompt. After the package is installed, you need to restart.
[ root@gysl ~]# yum install  -y bash-completion
[ root@gysl ~]# reboot
[ root@gysl ~]# systemctl re
reboot                 reload                 reload-or-try-restart  reset-failed
reenable               reload-or-restart      rescue                 restart
  1. Use official sources for kernel updates. Officials also provide kernel updates, but there are some limitations. Smart upgrades to the latest officially designated version may not meet the requirements.
[ root@gysl ~]# yum -y update kernel
  1. Delete the old version of the kernel.
[ root@gysl ~]# rpm -qa|grep kernel
kernel-tools-3.10.0-862.el7.x86_64
kernel-ml-4.19.0-1.el7.elrepo.x86_64
kernel-tools-libs-3.10.0-862.el7.x86_64
kernel-3.10.0-862.el7.x86_64
kernel-3.10.0-862.14.4.el7.x86_64

Use the rpm and yum remove commands to delete the old version of the kernel or components (the following command deletes the latest version of the kernel, the operation is similar). You can install new components and then delete old versions of components.

[ root@gysl ~]# rpm -e kernel-ml-4.19.0-1.el7.elrepo.x86_64

Three. Summary#

  1. System kernel upgrade is a process that requires careful operation and requires us to be bold and careful. Strict testing is required in the test environment to be online to the production environment.
  2. At the time of writing this article, I have performed the same steps on both the VMWare and Hyper-V platforms, and found that after the upgrade is completed on the Hyper-V platform, it cannot start normally and no relevant log records can be found. My system information is as follows:
[ root@gysl ~]# hostnamectl
 Static hostname: gysl
   Icon name: computer-vm
   Chassis: vm
  Machine ID: ca4cb61abf7748a7bae1dd5a94c4c9da
   Boot ID: ff1263b7386f49bd9f4681fd6b6bc964
 Virtualization: microsoft
 Operating System: CentOS Linux 7(Core)
  CPE OS Name: cpe:/o:centos:centos:7
   Kernel: Linux 3.10.0-862.el7.x86_64
  Architecture: x86-64

The startup interface is as follows:

It has not been tested on the kvm platform yet, and I don't know the specific situation.

If you have any friends who know how to solve the problem of not entering the system normally after the kernel is upgraded in the Hyper-V virtualization environment, please enlighten me, I would be very grateful.

Four. References#

  1. http://elrepo.org/tiki/kernel-ml
  2. https://www.kernel.org

Recommended Posts

CentOS7.5-1804 system kernel upgrade
Centos7 upgrade kernel
CentOS6.5 upgrade kernel to 3.10.28
Centos kernel version upgrade
Three methods of Centos kernel upgrade
Linux: Centos7 upgrade the original kernel
Remember a centos 7 kernel upgrade accident
CentOS7 upgrade python3
CentOS6.X upgrade kernel Kernel
centos system management
Centos6.5 openssh upgrade
centos6.9 rabbitmq 3.6.8 upgrade 3.8.2
Linux kernel compilation and CentOS system installation
Centos 6.4 python 2.6 upgrade to 2.7
Correspondence between CentOS (RHEL) kernel version and system version
Centos 6.4 python 2.6 upgrade to 2.7
Centos kernel compilation configuration
CentOS system startup process
VirtualBox install CentOS system
Centos7 delete useless kernel
Centos delete redundant kernel
Centos7.2 system optimization original
Centos system process management
Centos default python2.6 upgrade to
CentOS upgrade python2 to pyth
Centos various time [system time/hardware time]
CentOS system optimization script, unfinished
Centos7 system commonly used commands
Install docker on Centos system
Debug Kernel Panic in Centos
Centos system modify time zone
centos6.5: gcc upgrade (5.2.0) process record
Centos backend system setup record
Centos6 system boot loading process
Linux centos system boot process
CentOS 6.X system initialization script
Detailed method of installing Kernel 5.x kernel version on CentOS 8 system
How to upgrade CentOS7 to CentOS8 (detailed steps)
CentOS 8 (2)
Upgrade OpenSSL and OpenSSH under CentOS7
Centos7 upgrade git version control tool
Centos6.7 comes with python upgrade to
CentOS 7.X system installation and optimization
CentOS 8 (1)
CentOS7.2 install lepus database monitoring system
Install Centos7 operating system in Docker
001. Installation of enterprise-level CentOS7.6 operating system
Ubuntu upgrade software and ubuntu upgrade system commands
Manually upgrade node version under CentOs
Manually upgrade node version under CentOs
CentOS 7 system installation and configuration graphic tutorial
Graphic KVM to install CentOS7.6 operating system
ubuntu16.04 method steps to upgrade the kernel
CentOS7 installs IT asset management system Snipe-IT
CentOS7 system increase swap operation method example
CentOS7 build FastDFS distributed file system (on)
Centos7.6 operating system installation and optimization record
Install mysql8.0.13 version under Linux CentOS7 system
Centos python3 compile installation and compile gcc upgrade
CentOS7 system yum way to install MySQL5.7
IP address problem after restarting CentOS 7 system