Redhat6.5-rpm升级内核

一、环境
系统:red hat6.5
内核:2.6.32-431.el6.x86_64
软件包:kernel-lt-4.4.232-1.el6.elrepo.x86_64.rpm

二、准备工作:

1、查看当前操作系统
[root@test01 ~]# cd /tools/
[root@test01 tools]# uname -a
Linux test01 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@test01 tools]#

2、下载高版本内核:
kernel-lt-4.4.232-1.el6.elrepo.x86_64.rpm

3、安装内核:
[root@test01 tools]# rpm -ivh kernel-lt-4.4.232-1.el6.elrepo.x86_64.rpm
warning: kernel-lt-4.4.232-1.el6.elrepo.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Preparing... ########################################### [100%]
1:kernel-lt ########################################### [100%]
[root@test01 tools]#

4、修改 /etc/grub.conf 默认启动内核 修改配置文件前备份一下,将default=1,改为 default=0;(如果想换回去,只要将default=1)

[root@test01 tools]# cp /etc/grub.conf /etc/grub.conf_202009081545.bak
[root@test01 tools]# vim /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda6
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (4.4.232-1.el6.elrepo.x86_64)
root (hd0,0)
kernel /vmlinuz-4.4.232-1.el6.elrepo.x86_64 ro root=UUID=dbcbec55-b7a4-4c2c-82d6-221cf3ca3a09 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-4.4.232-1.el6.elrepo.x86_64.img
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=dbcbec55-b7a4-4c2c-82d6-221cf3ca3a09 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img

5、启服务器,并查看内核
[root@test01 tools]# reboot

Broadcast message from root@test01
(/dev/pts/2) at 15:49 ...

The system is going down for reboot NOW!
[root@test01 tools]#


重启后查看:
[root@test01 ~]# cd /tools/
[root@test01 tools]# uname -a
Linux test01 4.4.232-1.el6.elrepo.x86_64 #1 SMP Fri Jul 31 11:46:30 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@test01 tools]# uname -r
4.4.232-1.el6.elrepo.x86_64

6、grub 配置文件补充说明
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (3.10.104-1.el6.elrepo.x86_64)
root (hd0,0)
kernel/boot/vmlinuz-3.10.104-1.el6.elrepo.x86_64 ro console=tty0 console=ttyS0root=UUID=9223e283-dd69-4b25-8a8f-49b786e27def rd_NO_LUKS rd_NO_LVMLANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgbquiet

注释:default=0 表示 表示第一个title下的内容为默认启动的kernel
timeout=5 表示等待进入选择kernel或操作系统菜单的时间为5秒
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
grub是以hd来识别磁盘的,第一磁盘为hd0,第二个磁盘为hd1...,而hd0,0表示第一个磁盘的第一个分区,hd0,1表示第一个磁盘的第二个分区 依次类推。

posted @ 2020-09-08 16:22  深海蓝精灵  阅读(1205)  评论(1编辑  收藏  举报