centos6.4内核升级到4.9版本

linux 内核升级
[root@master ~]# uname -r
2.6.32-431.el6.x86_64

内核下载官网: http://www.kernel.org 
内核下载官网: https://mirrors.edge.kernel.org/pub/linux/kernel/
1.下载源码包
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.122.tar.xz
2.安装升级组件
yum -y groupinstall "Development Tools"
yum -y install ncurses-devel qt-devel hmaccalc zlib-devel binutils-devel elfutils-libelf-devel
3.解压源码包
tar xvf linux-4.9.122.tar.xz
centos6.4内核升级到4.9版本
[root@master docker]# cd linux-4.9.122
[root@master linux-4.9.122]# cp /boot/config-2.6.32-431.el6.x86_64 .
将当前系统的配置文件复制到要升级的内核文件中,使用当前系统的内核配置更新到新内核上面。
4.更新内核并备份当前内核
[root@master linux-4.9.122]# sh -c 'yes "" | make oldconfig'
make oldconfig会读取当前目录下的.config文件,在.config文件里没有找到的选项则提示用户填写,然后备份.config文件为.config.old,并生成新的.config文件
参考 http://stackoverflow.com/questions/4178526/what-does-make-oldconfig-do-exactly-linux-kernel-makefile和https://www.linuxidc.com/Linux/2014-01/95511.htm

5.编译内核文件
make -j20 bzImage #生成内核文件
make -j20 modules #编译模块
make -j20 modules_install #编译安装模块
要严格按照这个先后顺序进行编译
-j后面的数字是线程数,用于加快编译速度,一般的经验是,有多少G内存,就填写那个数字,例如有4G内存,则为-j4
[root@master linux-4.9.122]# make -j20 bzImage && make -j20 modules && make -j20 modules_install && make install
centos6.4内核升级到4.9版本
时间较长

ERROR: modinfo: could not find module sco
ERROR: modinfo: could not find module l2cap
ERROR: modinfo: could not find module scsi_tgt
ERROR: modinfo: could not find module ext3
ERROR: modinfo: could not find module jbd
ERROR: modinfo: could not find module microcode
ERROR: modinfo: could not find module vmware_balloon
ERROR: modinfo: could not find module crc_t10dif
出现这些报错可以忽略掉
修改配置文件/etc/grub.conf,设置新的内核启动
新安装的内核在第一个位置,设置default=0
centos6.4内核升级到4.9版本

修改配置文件后,reboot重新启动机器
[root@master ~]# uname -r
4.9.122
[root@master ~]# uname -a
Linux master.example.com 4.9.122 #1 SMP Fri Nov 1 21:23:26 CST 2019 x86_64 x86_64 x86_64 GNU/Linux
查询看到内核升级到4.9了,可以安装docker用了
注:
如果中间由于什么原因中断了安装,清理编译的数据后进行上面动作重新编译安装升级内核
make mrproper #清除编译安装的数据

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章