ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

CentOS7升级内核

2022-08-27 12:30:36  阅读:312  来源: 互联网

标签:升级 x86 elrepo CentOS7 etc 64 内核 el7


1、查看当前内核版本 $ uname -r 3.10.0-1160.25.1.el7.x86_64 $ uname -a Linux localhost.localdomain 3.10.0-1160.25.1.el7.x86_64 #1 SMP Wed Apr 28 21:49:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) 2、更新yum仓库 2.1、替换阿里云yum源,并升级 $ rm /etc/yum.repos.d/*.repo $ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo $ wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo $ yum clean all && yum -y update 2.2、启用elrepo仓库 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm 3、升级内核 3.1、安装最新版本内核 $ yum --enablerepo=elrepo-kernel install kernel-ml 3.2、设置 grub2 内核安装好后,需要设置为默认启动选项并重启后才会生效 3.2.1、查看系统上的所有可用内核: $ awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : CentOS Linux (5.12.1-1.el7.elrepo.x86_64) 7 (Core) 1 : CentOS Linux (3.10.0-1160.25.1.el7.x86_64) 7 (Core) 2 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core) 3 : CentOS Linux (0-rescue-16ba4d58b7b74338bfd60f5ddb0c8483) 7 (Core)

 

 

3.2.2、设置新的内核为grub2的默认版本 服务器上存在4 个内核,我们要使用 5.12.1这个版本,可以通过 grub2-set-default 0 命令或编辑 /etc/default/grub 文件来设置 方法1、通过 grub2-set-default 0 命令设置 其中 0 是上面查询出来的可用内核 grub2-set-default 0 方法2、编辑 /etc/default/grub 文件 设置 GRUB_DEFAULT=0,通过上面查询显示的编号为 0 的内核作为默认内核:   $ vim /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=0 GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rhgb quiet" GRUB_DISABLE_RECOVERY="true" 3.2.3、生成 grub 配置文件并重启 $ grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.12.1-1.el7.elrepo.x86_64 Found initrd image: /boot/initramfs-5.12.1-1.el7.elrepo.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-1160.25.1.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.25.1.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-16ba4d58b7b74338bfd60f5ddb0c8483 Found initrd image: /boot/initramfs-0-rescue-16ba4d58b7b74338bfd60f5ddb0c8483.img done   $ reboot 4.验证 $ uname -r 5.12.1-1.el7.elrepo.x86_64

本文来自博客园,作者:愤怒的小白~,转载请注明原文链接:https://www.cnblogs.com/mgsudu/p/14741297.html

标签:升级,x86,elrepo,CentOS7,etc,64,内核,el7
来源: https://www.cnblogs.com/linux985/p/16630340.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有