环境
centos 7
升级步骤
检查现在的内核版本
代码语言:javascript复制# uname -sr
Linux 3.10.0-1062.9.1.el7.x86_64
要在 CentOS 7 上启用 ELRepo 仓库
代码语言:javascript复制# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
列出可用的内核相关包
命令:yum --disablerepo=“*” --enablerepo=“elrepo-kernel” list available
代码语言:javascript复制# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
........此处省略......
elrepo-kernel | 3.0 kB 00:00:00
elrepo-kernel/primary_db | 2.0 MB 00:00:01
Available Packages
elrepo-release.noarch 7.0-5.el7.elrepo elrepo-kernel
kernel-lt.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.161-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
perf.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
python-perf.x86_64 5.15.4-1.el7.elrepo elrepo-kernel
安装最新的主线稳定内核
代码语言:javascript复制yum --enablerepo=elrepo-kernel install kernel-ml
查看当前操作系统所有内核版本
代码语言:javascript复制# 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.15.4-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.1.3.el7.x86_64-advanced-f41e390f-835b-4223-a9bb-9b45984ddf8d' {
menuentry 'CentOS Linux (3.10.0-1062.9.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.1.3.el7.x86_64-advanced-f41e390f-835b-4223-a9bb-9b45984ddf8d' {
menuentry 'CentOS Linux (3.10.0-957.1.3.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-957.1.3.el7.x86_64-advanced-f41e390f-835b-4223-a9bb-9b45984ddf8d' {
menuentry 'CentOS Linux (0-rescue-05cb8c7b39fe0f70e3ce97e5beab809d) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-05cb8c7b39fe0f70e3ce97e5beab809d-advanced-f41e390f-835b-4223-a9bb-9b45984ddf8d' {
查看系统当前的默认内核
代码语言:javascript复制# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1062.9.1.el7.x86_64) 7 (Core)
设置默认启动内核为
代码语言:javascript复制# grub2-set-default 'CentOS Linux (5.15.4-1.el7.elrepo.x86_64) 7 (Core)'