博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Centos7 更换内核到4.16的尝试
阅读量:5997 次
发布时间:2019-06-20

本文共 5595 字,大约阅读时间需要 18 分钟。

背景:

特殊需求,需要使用kernel 4.x版本,在云上ECS如何更换呢?

怂一下先:

请对生产环境,保持敬畏之心,务必做好快照备份!
请对生产环境,保持敬畏之心,务必做好快照备份!
请对生产环境,保持敬畏之心,务必做好快照备份!

1,看下内核先

# uname -r3.10.0-514.26.2.el7.x86_64

2,升级内核需要先导入elrepo的key,然后安装elrepo的yum源:

# rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org#  rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpmRetrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpmRetrieving http://elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpmPreparing...                          ################################# [100%]Updating / installing...   1:elrepo-release-7.0-3.el7.elrepo  ################################# [100%]

3,看下源上的内核版本

# yum --disablerepo="*" --enablerepo="elrepo-kernel" list availableLoaded plugins: fastestmirrorelrepo-kernel                                                                                           | 2.9 kB  00:00:00     elrepo-kernel/primary_db       FAILED                                                        ] 4.1 kB/s |  83 kB  00:06:58 ETA http://elrepo.org/linux/kernel/el7/x86_64/repodata/b970175c81e43b64f8ed487034e08db0f81ba50f2ba1a770606d4a85f7c3c1ab-primary.sqlite.bz2: [Errno 14] curl#18 - "transfer closed with 1740046 bytes remaining to read"Trying other mirror.elrepo-kernel/primary_db       FAILED                                          http://mirrors.coreix.net/elrepo/kernel/el7/x86_64/repodata/b970175c81e43b64f8ed487034e08db0f81ba50f2ba1a770606d4a85f7c3c1ab-primary.sqlite.bz2: [Errno 14] curl#6 - "Could not resolve host: mirrors.coreix.net; Unknown error"Trying other mirror.elrepo-kernel/primary_db                                                                                | 1.7 MB  00:00:02     Determining fastest mirrors * elrepo-kernel: mirrors.tuna.tsinghua.edu.cnAvailable Packageskernel-lt.x86_64                                               4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-devel.x86_64                                         4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-doc.noarch                                           4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-headers.x86_64                                       4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-tools.x86_64                                         4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-tools-libs.x86_64                                    4.4.131-1.el7.elrepo                               elrepo-kernelkernel-lt-tools-libs-devel.x86_64                              4.4.131-1.el7.elrepo                               elrepo-kernelkernel-ml.x86_64                                               4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-devel.x86_64                                         4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-doc.noarch                                           4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-headers.x86_64                                       4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-tools.x86_64                                         4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-tools-libs.x86_64                                    4.16.8-1.el7.elrepo                                elrepo-kernelkernel-ml-tools-libs-devel.x86_64                              4.16.8-1.el7.elrepo                                elrepo-kernelperf.x86_64                                                    4.16.8-1.el7.elrepo                                elrepo-kernelpython-perf.x86_64                                             4.16.8-1.el7.elrepo                                elrepo-kernel

4,安装内核

# yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64

image

版本性质:主分支ml(mainline),稳定版(stable),长期维护版lt(longterm)

5,查看内核是否安装完成

# rpm -qa |grep kernelkernel-ml-devel-4.16.8-1.el7.elrepo.x86_64kernel-3.10.0-327.el7.x86_64kernel-headers-3.10.0-514.26.2.el7.x86_64kernel-ml-4.16.8-1.el7.elrepo.x86_64kernel-3.10.0-514.26.2.el7.x86_64kernel-tools-libs-3.10.0-514.26.2.el7.x86_64kernel-tools-3.10.0-514.26.2.el7.x86_64

6,查看并修改grub的启动顺序

# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfgCentOS Linux (4.16.8-1.el7.elrepo.x86_64) 7 (Core)CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)CentOS Linux (0-rescue-36dc953195bb4389870d2591ff6bfea5) 7 (Core)

注:第一个是4.16,但是对应的顺序是0

# vi /etc/default/grub GRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=saved(这里改成0)GRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="console"GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 console=tty0 console=ttyS0,115200n8"GRUB_DISABLE_RECOVERY="true"

7,生成grub重新创建内核配置并重启

# grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file ...Found linux image: /boot/vmlinuz-4.16.8-1.el7.elrepo.x86_64Found initrd image: /boot/initramfs-4.16.8-1.el7.elrepo.x86_64.imgFound linux image: /boot/vmlinuz-3.10.0-514.26.2.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-514.26.2.el7.x86_64.imgFound linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-36dc953195bb4389870d2591ff6bfea5Found initrd image: /boot/initramfs-0-rescue-36dc953195bb4389870d2591ff6bfea5.imgdone# reboot

8,重启成功后登陆确认内核版本

# uname -r4.16.8-1.el7.elrepo.x86_64

更换成功~请务必做好新内核的测试,再考虑生产环境的更换

转载地址:http://gchlx.baihongyu.com/

你可能感兴趣的文章
Discovery CentOS6.4 issue
查看>>
AI思维:给人类教育的三项启示
查看>>
迈向微软虚拟化,你准备好了吗
查看>>
【VMCloud云平台】SCVMM进阶篇(一)网络虚拟化(1)
查看>>
重构入口和场景,HTML5改变的不仅仅是App
查看>>
cocos studio和cocos creator关系
查看>>
SVN “不能打开文件“.svn/lock” 权限不够”精解
查看>>
罗永浩以为×××短信给了马化腾一记暴击,实际……
查看>>
《失业的程序员》终极花絮:跌倒了请对原地做个标记,并在其他地方爬起来
查看>>
Fitbit IPO给智能硬件从业者的启示
查看>>
如何一小时做出裂变海报文案?
查看>>
云蜘蛛时代,搜索排名一夜全自动霸屏?
查看>>
Android视频
查看>>
netty支持的协议
查看>>
htmlspecialchars()函数
查看>>
配置新系统(Win7 x64)
查看>>
使用 IntraWeb (4) - 页面布局之 TIWRegion
查看>>
【javascript基础】5、创建对象
查看>>
备忘“与”、“非”、“或”、“异或” 运算
查看>>
增强版字典DictionaryEx
查看>>