升级前的内核版本为:2.6.32-431.el6.x86_64
升级后的内核版本为:3.10.101-1.el6.elrepo.x86_64
升级方法:
1.导入key
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
2.安装elrepo的yum源
rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
3.安装内核
yum --enablerepo=elrepo-kernel install kernel-lt -y
4.修改启动顺序
vi /etc/grub.conf
看到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/sda2 # initrd /initrd-[generic-]version.img #boot=/dev/sda default=1 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (3.10.101-1.el6.elrepo.x86_64) root (hd0,0) kernel /vmlinuz-3.10.101-1.el6.elrepo.x86_64 ro root=UUID=7cb8b8e8-898e-4980-82e3-6f590b2a2145 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-3.10.101-1.el6.elrepo.x86_64.img title CentOS (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=7cb8b8e8-898e-4980-82e3-6f590b2a2145 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
从配置文件看出:系统中安装有两个内核,分别是 CentOS (3.10.101-1.el6.elrepo.x86_64) 和 CentOS (2.6.32-431.el6.x86_64)
default=1表示启动第二个内核,既:CentOS (2.6.32-431.el6.x86_64)
修改default=1为default=0,既启动第一个内核:CentOS (3.10.101-1.el6.elrepo.x86_64)
5,重启系统
reboot
6,查看内核版本
uname -r
此时内核版本为:3.10.101-1.el6.elrepo.x86_64