一. 查看当前内核
uname -r
二. 下载内核文件
wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.7.tar.gz
tar zxvf linux-3.7.tar.gz
cd linux-3.7
三. 清楚环境变量,选择编译内核参数
make mrproper #清除环境变量,即清除配置文件
make menuconfig #在菜单模式下选择需要编译的内核模块
四. 安装 编译内核
make clean #清除安装
make bzImage #生成内核文件
make modules #编译模块
make modules_install #安装模块
make install #安装
五. 修改grub.conf 文件 将 default=1 改成 default=0
===================================================================================
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (3.7.4)
root (hd0,0)
kernel /boot/vmlinuz-3.7.4 ro root=UUID=2fe4bf1c-7d56-412a-b91c-4da55f91177c rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM
rd_NO_DM rhgb quiet
initrd /boot/initramfs-3.7.4.img
title CentOS (2.6.32-279.19.1.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-279.19.1.el6.x86_64 ro root=UUID=2fe4bf1c-7d56-412a-b91c-4da55f91177c rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=
zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-279.19.1.el6.x86_64.img
title CentOS (2.6.32-279.el6.x86_64)
root (hd0,0)
kernel /boot/vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=2fe4bf1c-7d56-412a-b91c-4da55f91177c rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN
.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
initrd /boot/initramfs-2.6.32-279.el6.x86_64.img
=====================================================================================
六. 重启服务器
reboot
uname -r