CentOS6内核更换为:2.6.32-504.3.3.el6.x86_64
rpm -ivh http://www.johntitorblog.com/wp-content/oldfile/kernel-firmware-2.6.32-504.3.3.el6.noarch.rpm
rpm -ivh http://www.johntitorblog.com/wp-content/oldfile/kernel-2.6.32-504.3.3.el6.x86_64.rpm --force
CentOS7内核更换为:3.10.0-229.1.2.el7.x86_64
rpm -ivh http://www.johntitorblog.com/wp-content/oldfile/kernel-3.10.0-229.1.2.el7.x86_64.rpm --force
查看内核是否安装成功
rpm -qa | grep kernel
然后重启。
用uname -r
查看是否生效
此外,centos7切换内核更完整的文章如下。
1. 添加repo库 yum -y install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm 2. 导入签名 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org 3. 差看长期支持版本 [root@localhost ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available | grep kernel-lt kernel-lt.x86_64 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-headers.x86_64 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-tools.x86_64 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 5.4.210-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs-devel.x86_64 5.4.210-1.el7.elrepo elrepo-kernel 4. 安装长期稳定版本 yum --enablerepo=elrepo-kernel install kernel-lt 5. 切换内核版本 # 查看所有可用内核版本 [root@localhost ~]# grubby --info=ALL | grep ^kernel kernel=/boot/vmlinuz-0-rescue-e6b1be1665514df5b07c55fd799bfbf0 kernel=/boot/vmlinuz-5.4.210-1.el7.elrepo.x86_64 kernel=/boot/vmlinuz-3.10.0-1160.66.1.el7.x86_64 kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64 kernel=/boot/vmlinuz-0-rescue-f8f95d1d9b764ae99f2fc289a16fc263 #查看默认的内核版本 [root@localhost ~]# grubby --default-kernel /boot/vmlinuz-3.10.0-1160.66.1.el7.x86_64 # 设置内核版本 grubby --set-default "/boot/vmlinuz-5.4.210-1.el7.elrepo.x86_64" #重启 reboot 6. 删除旧内核 [root@localhost ~]# rpm -qa | grep kernel kernel-tools-libs-3.10.0-1160.66.1.el7.x86_64 kernel-3.10.0-1160.66.1.el7.x86_64 kernel-tools-3.10.0-1160.66.1.el7.x86_64 kernel-3.10.0-1160.el7.x86_64 kernel-lt-5.4.210-1.el7.elrepo.x86_64 yum remove kernel-tools-libs-3.10.0-1160.66.1.el7.x86_64 \ kernel-3.10.0-1160.66.1.el7.x86_64 \ kernel-tools-3.10.0-1160.66.1.el7.x86_64 \ kernel-3.10.0-1160.el7.x86_64 [root@localhost ~]# uname -r 5.4.210-1.el7.elrepo.x86_64 7. 离线升级 7.1 下载rpm包 curl -O https://mirrors.aliyun.com/elrepo/kernel/el7/x86_64/RPMS/kernel-lt-5.4.212-1.el7.elrepo.x86_64.rpm 7.2 安装 yum install kernel-lt-5.4.212-1.el7.elrepo.x86_64.rpm 7.3 批量删除旧核心 rpm -qa | grep kernel | grep -v $(uname -r) | awk '{print "yum remove -y "$1}' | sh END