Installation/upgrade method and suggestion
1. For CentOS/RHEL systems, try to use yum or RPM packages to install/upgrade the kernel. It should be noted that Red Hat's Red Hat Linux service requires subscription.
2. Install the new kernel instead of directly upgrading the kernel. Installing the new kernel will not overwrite the old kernel, and the upgrade will cause the new kernel to directly replace the old kernel, which may cause the system to fail to start, and the installation can also allow us to roll back after the upgrade. s Choice.
3. Generally, for most Linux distributions, use yum/dnf and the official distribution repository to upgrade the kernel. This method can only be upgraded to the latest version provided by the distribution’s repository, not the Linux kernel The latest kernel released by the organization.
4. If you want to use the latest kernel quickly and safely, the CentOS/RHEL system does not support yum to install or upgrade directly. Then we can use ELRepo (third-party repository) to install and upgrade the kernel.
5. Download the source code package of the new kernel to compile and install. This method helps us to learn the underlying knowledge of the kernel in more detail, but compiling and installing is not recommended in a production environment.
6. Try to use the latest Linux distribution. The new Liunx distribution includes the new kernel maintained by the distribution. If necessary, please use yum upgrade or yum update to update your system. For Ubuntu, Debian and other distributions, use apt-get update to update.
Purpose of installing/upgrading the new kernel
- Many out of security considerations, such as avoiding vulnerabilities found in previous versions
- Know the kernel more fully, understand the various kernel modules and functions of the kernel
- Better use/experience the new functions and features of the new
kernel Linux kernel versions are divided into mainline, stable and long-term versions. All kernel versions can be obtained on the official kernel development website https://www.kernel.org.
Official kernel download for each version
163 mirror station kernel download
Install/upgrade kernel on CentOS
There are usually two ways to upgrade the Linux kernel:
1. Download the new version of the kernel to the server, compile and install, and then delete the old kernel. Advantage: You can fully control the compilation items. Disadvantages: slow and easy to fail;
2. Use yum method to install, the advantages are: fast and convenient, high success rate.
[root@localhost ~]# cat /etc/redhat-release //查看系统版本
CentOS release 6.8 (Final)
[root@localhost ~]# cat /proc/version
Linux version 2.6.32-642.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Tue May 10 17:27:01 UTC 2016
[root@localhost ~]# uname -r //查看内核版本
2.6.32-642.el6.x86_64
[root@localhost ~]# yum list kernel --showduplicates //查看yum可升级的内核版本
...
已安装的软件包
kernel.x86_64 2.6.32-642.el6 @anaconda-CentOS-201605220104.x86_64/6.8
可安装的软件包
kernel.x86_64 2.6.32-754.el6 base
kernel.x86_64 2.6.32-754.2.1.el6 updates
kernel.x86_64 2.6.32-754.3.5.el6 updates
kernel.x86_64 2.6.32-754.6.3.el6 updates
kernel.x86_64 2.6.32-754.9.1.el6 updates
kernel.x86_64 2.6.32-754.10.1.el6 updates
kernel.x86_64 2.6.32-754.11.1.el6 updates
kernel.x86_64 2.6.32-754.12.1.el6 updates
kernel.x86_64 2.6.32-754.14.2.el6 updates
kernel.x86_64 2.6.32-754.15.3.el6 updates
kernel.x86_64 2.6.32-754.17.1.el6 updates
kernel.x86_64 2.6.32-754.18.2.el6 updates
kernel.x86_64 2.6.32-754.22.1.el6 updates
kernel.x86_64 2.6.32-754.23.1.el6 updates
kernel.x86_64 2.6.32-754.24.2.el6 updates
kernel.x86_64 2.6.32-754.24.3.el6 updates
kernel.x86_64 2.6.32-754.25.1.el6 updates
kernel.x86_64 2.6.32-754.27.1.el6 updates
kernel.x86_64 2.6.32-754.28.1.el6 updates
kernel.x86_64 2.6.32-754.29.1.el6 updates
kernel.x86_64 2.6.32-754.29.2.el6 updates
[root@localhost ~]# yum update kernel-2.6.32-754.el6.x86_64 //直接执行update升级内核
...
===============================================================================================================================
软件包 架构 版本 仓库 大小
===============================================================================================================================
正在安装:
kernel x86_64 2.6.32-754.el6 base 32 M
为依赖而更新:
kernel-firmware noarch 2.6.32-754.29.2.el6 updates 29 M
...
已安装:
kernel.x86_64 0:2.6.32-754.el6
作为依赖被升级:
kernel-firmware.noarch 0:2.6.32-754.29.2.el6
完毕!
[root@localhost ~]# reboot //重启系统
[root@localhost ~]# cat /proc/version
Linux version 2.6.32-754.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC) ) #1 SMP Tue Jun 19 21:26:04 UTC 2018
[root@localhost ~]# uname -r
2.6.32-754.el6.x86_64
Downgrade the kernel on CentOS
[root@localhost ~]# ls *.rpm //内核版本2.6.32-358rpm包
kernel-2.6.32-358.el6.x86_64.rpm kernel-firmware-2.6.32-358.el6.noarch.rpm
[root@vos vos3000]# uname -r //查看降级之前的系统内核版本
2.6.32-642.el6.x86_64
[root@localhost ~]# yum -y remove kernel kernel-firmware
...
删除:
kernel-firmware.noarch 0:2.6.32-642.el6
完毕!
[root@vos vos3000]# yum -y install kernel-2.6.32-358.el6.x86_64.rpm kernel-firmware-2.6.32-358.el6.noarch.rpm
...
已安装:
kernel.x86_64 0:2.6.32-358.el6 kernel-firmware.noarch 0:2.6.32-358.el6
完毕!
[root@localhost ~]# reboot //重启系统
[root@vos ~]# uname -r //查看降级后内核版本
2.6.32-358.el6.x86_64
[root@vos ~]# cat /proc/version
Linux version 2.6.32-358.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Fri Feb 22 00:31:26 UTC 2013
Prohibit kernel updates:
[root@spgpu ~]# vim /etc/yum.conf
在[main]部分加上:
exclude=kernel* centos-release
In this way, the kernel will not be updated during yum update.
https://mp.weixin.qq.com/s/19fNmg77H3_g1kWsllbOcw