CentOS6 / 7
Clean up using the package-cleanup command When leaving two kernels from the newest one and erasing the rest
[user01@centos7 ~]$ sudo package-cleanup --oldkernels --count=2
CentOS8
Use dnf to remove older packages above installonly_limit There is no kernel-related setting on the command line, but in most cases installonly is set to kernel-related only. Execute remove --oldinstallonly after confirming with dnf repoquery --installonly. However, since CentOS 8 at hand is set to installonly_limit = 3, I feel that it will not be a situation that requires much organization.
[user01@cent8 ~]$ dnf repoquery --installonly
[user01@cent8 ~]$ sudo dnf -y remove --oldinstallonly
CentOS6 / 7 Specify the number of generations to keep with installonly_limit = in /etc/yum.conf Set to 0 for unlimited. It seems that it is usually set to 5.
[user01@centos7 ~]$ sudo vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
CentOS8 Specify the number of generations to keep with installonly_limit = in /etc/dnf/dnf.conf However, setting it to 1,0 is considered unlimited. 2 is the lowest setting value.
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
[user01@cent8 ~]$
Recommended Posts