前言:centos
在升級系統的時候提示/boot分區空間不足,致使沒法安裝升級。當你/boot分區空間比較小的話,就須要清除老版本的kernel來是釋放空間,來安裝新的kernel。this
本文將介紹在RHEL系統中如何快捷的清除舊版本的kernel. spa
[root@ops ~]# rpm -q kernel kernel-2.6.32-358.el6.x86_64 kernel-2.6.32-573.12.1.el6.x86_64
## 安裝yum-utils ## ## Fedora 23/22 ## dnf install yum-utils ## Fedora 21/20/19/18/17/16, CentOS, Red Hat (RHEL) ## yum install yum-utils ## 使用Package-cleanup保留2個版本的kernel(count後面跟要保留的個數) ## package-cleanup --oldkernels --count=2
以下所示:debug
[root@ops ~]# package-cleanup --oldkernels --count=1 Loaded plugins: fastestmirror --> Running transaction check ---> Package kernel.x86_64 0:2.6.32-358.el6 will be erased --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================== Package Arch Version Repository Size ======================================================================================================================== Removing: kernel x86_64 2.6.32-358.el6 @anaconda-CentOS-201303020151.x86_64/6.4 116 M Transaction Summary ======================================================================================================================== Remove 1 Package(s) Installed size: 116 M Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Erasing : kernel-2.6.32-358.el6.x86_64 1/1 Verifying : kernel-2.6.32-358.el6.x86_64 1/1 Removed: kernel.x86_64 0:2.6.32-358.el6 Complete!
經過配置yum或者dnf來限制安裝kernel的數量code
編輯/etc/yum.conf 或者/etc/dnf/dnf.conf 配置installonly_limit:ci
installonly_limit=2
這樣就能夠限制最多隻會裝2個版本的內核。rem
原文: http://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/ get