Centos7.3默认3.10内核版本升级到4.X最新稳定版


查看当前系统内核版本 uname -r


1. 导入key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

2. 安装 elrepo 的yum源
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

3. 安装内核
在yum的elrepo源中,有最新版本内核。直接yum安装即可。
yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y


5. 设置系统启动顺序

查看系统启动项:

# 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 (4.15.9-1.el7.elrepo.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.26.2.el7.x86_64-advanced-976105f5-f402-456c-aadd-50de49ff88f9' {
menuentry 'CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.26.2.el7.x86_64-advanced-976105f5-f402-456c-aadd-50de49ff88f9' {
menuentry 'CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.26.2.el7.x86_64-advanced-976105f5-f402-456c-aadd-50de49ff88f9' {
menuentry 'CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-976105f5-f402-456c-aadd-50de49ff88f9' {
menuentry 'CentOS Linux (0-rescue-36dc953195bb4389870d2591ff6bfea5) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-36dc953195bb4389870d2591ff6bfea5-advanced-976105f5-f402-456c-aadd-50de49ff88f9' {

可以发现有最新版本的内核,此时可以设置最新版本内核为默认启动:
# grub2-set-default 'CentOS Linux (4.15.9-1.el7.elrepo.x86_64) 7 (Core)'

此时,查看默认启动的系统版本grub2-editenv list:
grub2-editenv list
saved_entry=CentOS Linux (4.15.9-1.el7.elrepo.x86_64) 7 (Core)

6. reboot,重启之后再次查看 uname -a

# uname -a
Linux tech-srv01 4.15.9-1.el7.elrepo.x86_64 #1 SMP Sun Mar 11 16:19:17 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux


发布了211 篇原创文章 · 获赞 29 · 访问量 36万+

猜你喜欢

转载自blog.csdn.net/wuhualong1314/article/details/79542904

相关文章