centos7-内核版本降级

时间:2020-11-28 06:58:09

环境介绍

线上环境运行centos 内核版本规定为:

CentOS Linux release 7.3.1611 (Core)

查看内核版本参考命令:

[root@localhost ~]# cat /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

[root@localhost ~]# uname -a

Linux localhost.localdomain 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# rpm -qa |grep -i centos-release

centos-release-7-3.1611.el7.centos.x86_64

问题描述

安装MySQL 时候,升级系统软件包,顺手升级了内核版本;

[root@localhost ~]# cat /etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

操作目的

降级目前操作系统内核版本7.4为7.3

操作步骤

网上搜索下载centos-release文件地址已失效;

在此,采用解压安装镜像,然后拷贝安装软件包到目的服务器方式;

#将软件包上传至需要降级服务器;

[root@localhost ~]# ls

centos-release-7-3.1611.el7.centos.x86_64.rpm

#查看当前运行内核版本

[root@localhost boot]# uname -a

Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

#查看已安装内核版本

[root@localhost boot]# rpm -qa |grep kernel

kernel-3.10.0-514.el7.x86_64

kernel-tools-libs-3.10.0-693.5.2.el7.x86_64

kernel-tools-3.10.0-693.5.2.el7.x86_64

kernel-3.10.0-693.5.2.el7.x86_64

kernel-3.10.0-514.26.2.el7.x86_64

#卸载新版本内核

[root@localhost boot]# rpm -e kernel-3.10.0-514.el7.x86_64

#查看卸载后安装内核版本信息

[root@localhost boot]# rpm -qa |grep kernel

kernel-tools-libs-3.10.0-693.5.2.el7.x86_64

kernel-tools-3.10.0-693.5.2.el7.x86_64

kernel-3.10.0-693.5.2.el7.x86_64

kernel-3.10.0-514.26.2.el7.x86_64

#卸载内核附加文件

[root@localhost boot]# rpm -e kernel-3.10.0-514.26.2.el7.x86_64

#查看卸载后安装内核版本信息,已完全卸载

[root@localhost boot]# rpm -qa |grep kernel

kernel-tools-libs-3.10.0-693.5.2.el7.x86_64

kernel-tools-3.10.0-693.5.2.el7.x86_64

kernel-3.10.0-693.5.2.el7.x86_64

#查看内核发行版信息,此处仍未新版本7.4,需要降低发行版信息

[root@localhost ~]# rpm -qa |grep -i centos-release

centos-release-7-4.1708.el7.centos.x86_64

centos-release-7-3.1611.el7.centos.x86_64

#安装内核发行版rpm包,此rpm包网上没找到下载地址,直接解压了安装镜像,从安装包文件夹中导入服务器安装即可

[root@localhost ~]# rpm -ivh centos-release-7-3.1611.el7.centos.x86_64.rpm --force

Preparing...                          ################################# [100%]

Updating / installing...

1:centos-release-7-3.1611.el7.cento################################# [100%]

#查看已安装内核发行版信息

[root@localhost ~]# rpm -qa |grep -i centos-release

centos-release-7-4.1708.el7.centos.x86_64

centos-release-7-3.1611.el7.centos.x86_64

#卸载7.4内核发行版rpm包

[root@localhost ~]# rpm -ev centos-release-7-4.1708.el7.centos.x86_64

Preparing packages...

centos-release-7-4.1708.el7.centos.x86_64

#查看卸载后目前内核发行版rpm包信息为7.3

[root@localhost ~]# rpm -qa |grep -i centos-release

centos-release-7-3.1611.el7.centos.x86_64

#重启服务器

[root@localhost ~]# reboot

#查看目前内核发行版信息,内核版本为7.3,卸载成功

[root@localhost ~]# cat /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

[root@localhost ~]# uname -a

Linux localhost.localdomain 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

本文出自 “冰河-Linux” 博客,请务必保留此出处http://driver2ice.blog.51cto.com/3393349/1982764