RedHat Enterprise Linux 7.3升级新内核后,开机grub里会有两个内核选项;删掉不需要的旧内核。
(温馨提示:如果是官方内核更新,可删除旧内核,只留一个。非官方更新的新内核,建议留着一个官方版本和一个最新版本;新内核有问题,可换回官方版本;)
1.查看当前系统使用的内核(别删错了):
name -r
2.查找并显示当前系统有多少内核以及相关版本的文件:
rpm -qa | grep kernel
3.选择需要删除的内核以及相关文件
yum remove kernel-3.xxx.el7.x86_64
yum remove kernel-devel-3.xxx.el7.x86_64
或者
yum remove kernel-3.xxx.el7.x86_64 kernel-devel-3.xxx.el7.x86_64
4.重启后就可以看到,内核被删掉了,同时多余的启动项也自动被删掉了
(附:如果重启后旧内核选项还在,就进入/etc找到grub2.cfg(或者grub2-ef.cfg)删除里面的信息(开机时显示的信息))
以下为真机测试:
[root@42 stone]# uname -r
3.10.0-514.26.2.el7.x86_64
[root@42 stone]# rpm -qa | grep kernel
kernel-devel-3.10.0-514.26.2.el7.x86_64
kernel-devel-3.10.0-514.el7.x86_64
abrt-addon-kerneloops-2.1.11-45.el7.centos.x86_64
kernel-tools-libs-3.10.0-514.26.2.el7.x86_64
kernel-3.10.0-514.26.2.el7.x86_64
kernel-headers-3.10.0-514.26.2.el7.x86_64
kernel-3.10.0-514.el7.x86_64
kernel-tools-3.10.0-514.26.2.el7.x86_64
[root@42 stone]# yum remove kernel-3.10.0-514.el7.x86_64
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-
: manager
This system is not registered with Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-514.el7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================
Package Arch Version Repository Size
===============================================================================
Removing:
kernel x86_64 3.10.0-514.el7 @anaconda/7.3 148 M
Transaction Summary
===============================================================================
Remove 1 Package
Installed size: 148 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : kernel-3.10.0-514.el7.x86_64 1/1
base/x86_64 | 3.6 kB 00:00
base/x86_64/group_gz | 155 kB 00:00
base/x86_64/primary_db | 5.6 MB 00:19
epel/x86_64/metalink | 6.8 kB 00:00
epel/x86_64 | 4.3 kB 00:00
epel/x86_64/group_gz | 170 kB 00:00
epel/x86_64/updateinfo | 794 kB 00:03
epel/x86_64/primary_db | 4.8 MB 00:16
extras/x86_64 | 3.4 kB 00:00
extras/x86_64/primary_db | 190 kB 00:00
updates/x86_64 | 3.4 kB 00:00
updates/x86_64/primary_db | 7.8 MB 00:27
vivaldi | 2.9 kB 00:00
vivaldi/primary_db | 53 kB 00:00
Determining fastest mirrors
* epel: mirrors.ustc.edu.cn
Verifying : kernel-3.10.0-514.el7.x86_64 1/1
Removed:
kernel.x86_64 0:3.10.0-514.el7
Complete!
[root@42 stone]# yum remove kernel-devel-3.10.0-514.el7.x86_64
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.x86_64 0:3.10.0-514.el7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================
Package Arch Version Repository Size
==============================================================================
Removing:
kernel-devel x86_64 3.10.0-514.el7 @anaconda/7.3 34 M
Transaction Summary
==============================================================================
Remove 1 Package
Installed size: 34 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : kernel-devel-3.10.0-514.el7.x86_64 1/1
base/x86_64 | 3.6 kB 00:00:00
epel/x86_64/metalink | 6.3 kB 00:00:00
epel/x86_64 | 4.3 kB 00:00:00
epel/x86_64/updateinfo | 794 kB 00:00:04
epel/x86_64/primary_db | 4.8 MB 00:00:20
extras/x86_64 | 3.4 kB 00:00:00
updates/x86_64 | 3.4 kB 00:00:00
vivaldi | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
* epel: mirrors.ustc.edu.cn
Verifying : kernel-devel-3.10.0-514.el7.x86_64 1/1
Removed:
kernel-devel.x86_64 0:3.10.0-514.el7
Complete!
本文出自 “LINUX的学习与应用” 博客,请务必保留此出处http://stonepotian.blog.51cto.com/5154155/1949067
原文地址:http://stonepotian.blog.51cto.com/5154155/1949067