下载内核源代码我们下载需要的内核到/opt
cd /opt
wget
然后解压内核源代码, 创建一个指向内核源代码目录的linux字符链接:
tar -jxf linux-2.6.29.1.tar.bz2
ln -s linux-2.6.29.1 linux
cd linux

配置内核使用当前工作内核的配置文件做为新内核配置文件的基础是一个很好的主意. 因此我们拷贝已存的配置文件到/opt/linux:
make mrproper
cp /boot/config-`uname -r` ./.config
然后运行make menuconfig然后我们看到内核的配置菜单. 移动绿色光标到 Load an Alternate Configuration File 行后选择.config文件做为配置文件
然后浏览内核配置菜单, 选择你需要的功能. 完成配置后, 选择Exit, 回答下面的问题(Do you wish to save your new kernel configuration? 你希望保存新的内核配置吗?), 选择Yes

构建和安装新的内核构建和安装新的内核, 执行下面的3个命令:
make all
make modules_install
make install

启用新内核,修改/etc/grub.conf
我的grub.conf如下
grep -v “#” /etc/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.29.1)
root (hd0,0)
kernel /vmlinuz-2.6.29.1 ro root=/dev/sda2
initrd /initrd-2.6.29.1.img
title CentOS (2.6.9-78.0.13.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-78.0.13.EL ro root=/dev/sda2
initrd /initrd-2.6.9-78.0.13.EL.img
title CentOS (2.6.9-78.0.8.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-78.0.8.EL ro root=/dev/sda2
initrd /initrd-2.6.9-78.0.8.EL.img
title CentOS (2.6.26)
root (hd0,0)
kernel /vmlinuz-2.6.26 ro root=LABEL=/
initrd /initrd-2.6.26.img
title CentOS (2.6.9-67.0.22.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-67.0.22.EL ro root=LABEL=/
initrd /initrd-2.6.9-67.0.22.EL.img

现在重新启动系统:shutdown -r now
如果一切进展顺利, 你的新内核正常工作. 你可以通过运行下面命令来检查你的新内核是否运行:uname -r 这将会显示如:2.6.29.1