There are three main ways to do it:
- Use
package-cleanup
command fromyum-utils
- Use Fedora's
dnf remove
combined withdnf repoquery
- Set maximum number of installed kernels in
/etc/yum.conf
file
# yum install yum-utils # package-cleanup --oldkernels --count=2Second:
# dnf remove $(dnf repoquery --installonly --latest-limit 2 -q)Third:
# vim /etc/yum.conf installonly_limit=3 #set kernel count
See also: