欢迎光临
我们一直在努力

centos 7.X 编译安装内核升级到4.X

一:在运行k8s环境的时候,需要较新的内核支持,推荐使用ubuntu部署,使用centos系统可以升级linux kernel,需要在官网下载当前最新稳定长期支持版linux kernel 源码包:https://www.kernel.org/

1.1:下载源码包并编译安装:

[root@test-server ~]# uname  -a #查看当前内核版本
Linux k8s-node2.preview.com.novalocal 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
rpm包下载地址:http://elrepo.org/tiki/tiki-index.php #推荐使用编译安装,编译安装的功能和版本更方便自定义选择。
[root@test-server src]# tar xvf linux-4.14.78.tar.xz
[root@test-server src]# cd linux-4.14.78
#安装常用命令及编译安装环境
[root@test-server linux-4.14.78]# yum install hmaccalc zlib-develbinutils-devel elfutils-libelf-devel vim lrzsz tree screen \
lsof tcpdump wget  ntpdate  gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl  openssl-devel systemd-devel net-tools vim \
iotop bc  zip unzip zlib-devel lrzsz tree screen lsof ncurses-devel
#将当前系统内核配置文件拷贝到当前目录并重名为.config,此步骤为必须过程
[root@test-server linux-4.14.78]# cp /boot/config-3.10.0-862.el7.x86_64  ./.config
#开始编译内核 
[root@test-server linux-4.14.78]# make menuconfig #图像选择模块
[root@test-server linux-4.14.78]# sh -c 'yes "" | make oldconfig' #自动应答yes并编译
[root@test-server linux-4.14.78]# make -j20 bzImage #编译内核镜像,-j指定最多20个并发编译任务
[root@test-server linux-4.14.78]# make -j20 modules #编译模块
[root@test-server linux-4.14.78]# make -j20 modules_install
[root@test-server linux-4.14.78]# make install
sh ./arch/x86/boot/install.sh 4.14.78 arch/x86/boot/bzImage \
    System.map "/boot"            

1.2:修改默认启动kernel版本:

#查看当前引导项:
[root@test-server linux-4.14.78]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
CentOS Linux (4.14.78) 7 (Core)
CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-3bc7222482c9453985dbd25dc0d5f308) 7 (Core)
使用第一个引导:
[root@test-server linux-4.14.78]# grub2-set-default  0
[root@test-server ~]# reboot
[root@test-server ~]# uname  -a  #重启后验证新版本内核是否生效
Linux test-server.novalocal 4.14.78 #1 SMP Tue Oct 23 13:56:45 CST 2018 x86_64 x86_64 x86_64 GNU/Linux
赞(0) 打赏
未经允许不得转载:运维那些事 » centos 7.X 编译安装内核升级到4.X

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏