编译过后的内核实际上是通用的,所以可以把debian的linux内核移植到CentOS 7,实现懒人版的内核升级。
众所周知,两个发行版最大的区别就是包管理器不一样。debian采用deb包,而redhat采用rpm包,虽然有区别,但两者本质上都是压缩包,所以需要解压来手动安装。
一、下载内核二进制包
wgethttp://mirrors.kernel.org/debian/pool/main/l/linux/linux-image-4.9.0-rc8-amd64-unsigned_4.9~rc8-1~exp1_amd64.deb
二、解压安装
arxlinux-image-4.9.0-rc8-amd64-unsigned_4.9~rc8-1~exp1_amd64.deb tar-Jxfdata.tar.xz install-m644boot/vmlinuz-4.9.0-rc8-amd64/boot/vmlinuz-4.9.0-rc8-amd64 cp-Ravlib/modules/4.9.0-rc8-amd64/lib/modules/ depmod-a4.9.0-rc8-amd64
三、加入引导
dracut-f-v--hostonly-k'/lib/modules/4.9.0-rc8-amd64'/boot/initramfs-4.9.0-rc8-amd64.img4.9.0-rc8-amd64 grub2-mkconfig-o/boot/grub2/grub.cfg
四、修改引导顺序
1. 查看引导内有哪些内核
cat/boot/grub2/grub.cfg|grepmenuentry
输入结果:
[root@centos-512mb-sgp1-01~]#cat/boot/grub2/grub.cfg|grepmenuentry if[x"${feature_menuentry_id}"=xy];then menuentry_id_option="--id" menuentry_id_option="" exportmenuentry_id_option menuentry'CentOSLinux(4.9.0-rc8-amd64)7(Core)'--classcentos--classgnu-linux--classgnu--classos--unrestricted$menuentry_id_option'gnulinux-4.9.0-rc8-amd64-advanced-508f0c60-8ce4-48fa-a00e-8db45fa56da8'{ menuentry'CentOSLinux(3.10.0-327.36.3.el7.x86_64)7(Core)'--classcentos--classgnu-linux--classgnu--classos--unrestricted$menuentry_id_option'gnulinux-3.10.0-327.36.3.el7.x86_64-advanced-508f0c60-8ce4-48fa-a00e-8db45fa56da8'{ menuentry'CentOSLinux(0-rescue-d45b6a27fe9641bd8979101342a4f20b)7(Core)'--classcentos--classgnu-linux--classgnu--classos--unrestricted$menuentry_id_option'gnulinux-0-rescue-d45b6a27fe9641bd8979101342a4f20b-advanced-508f0c60-8ce4-48fa-a00e-8db45fa56da8'{
2.配置从默认内核启动,下面命令的内核名称根据系统内部查到的实际名称来替换:
grub2-set-default'CentOSLinux(4.9.0-rc8-amd64)7(Core)'
3.验证是否配置成功:
grub2-editenvlist
重启就可以完成更新内核了!