一、环境 系统:red hat6.6 内核:2.6.32-504.el6.x86_64 软件包:kernel-2.6.32-573.65.2.el6.x86_64.rpm
二、准备工作:
1、查看当前操作系统
[root@irora26 grub]# uname -a Linux irora26 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
2、下载高版本内核:
# 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/mapper/VolGroup-LogVol01 # 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 6 (2.6.32-504.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/LogVol01 SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-504.el6.x86_64.img
3、安装内核:
# rpm -ivh kernel-*.rpm
4、修改 /etc/grub.conf 默认启动内核 修改配置文件前备份一下,将default=0,改为 default=1;(如果想换回去,只要将default=0)
# cp /etc/grub.conf /etc/grub.conf_`date +%F`.bak # vim /etc/grub.conf
5、启服务器,并查看内核
# reboot
重启后查看:
# 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 # uname -r
6、检查系统各项功能是否正常,包括网络和一下特殊的硬件设备
7、grub 配置文件补充说明
default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=VolGroup/LogVol01 SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=VolGroup/LogVol00 rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-504.el6.x86_64.img
注释:default=0 表示 表示第一个title下的内容为默认启动的kernel timeout=5 表示等待进入选择kernel或操作系统菜单的时间为5秒 splashimage=(hd0,0)/boot/grub/splash.xpm.gz grub是以hd来识别磁盘的,第一磁盘为hd0,第二个磁盘为hd1...,而hd0,0表示第一个磁盘的第一个分区,hd0,1表示第一个磁盘的第二个分区 依次类推。