CentOS7 升级 Linux 内核
一、查看当前版本
uname -r
二、更新仓库
yum -y update
三、启用 ELRepo 仓库
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
可以发现,有5.4版本和6.3版本,可供选择:
[root@localhost ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* elrepo-kernel: hkg.mirror.rackspace.com
elrepo-kernel | 3.0 kB 00:00:00
elrepo-kernel/primary_db | 2.1 MB 00:00:00
Available Packages
elrepo-release.noarch 7.0-6.el7.elrepo elrepo-kernel
kernel-lt.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-devel.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
kernel-ml.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-devel.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-doc.noarch 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-headers.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 6.3.1-1.el7.elrepo elrepo-kernel
perf.x86_64 5.4.242-1.el7.elrepo elrepo-kernel
python-perf.x86_64
五、我们选择安装 5.4 内核
yum --enablerepo=elrepo-kernel install kernel-lt
六、设置 grub2
sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
[root@localhost ~]# sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (6.3.1-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.90.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-8de58ed1c51640c69d645d424c2c9945) 7 (Core)
[root@localhost ~]#
选择我们的内核ID,这里为0
sudo grub2-set-default 0
七、更新配置文件并重启到新内核
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot
版权声明:
作者:三炮不吃鱼
链接:https://www.keke.moe/archives/2193.html
文章版权归作者所有,未经允许请勿转载。
THE END