Very often you install a package just for short usage. Most of the time do these packages install a lot of dependencies along with it. After you don’t require the package anymore you remove it but the dependencies are not removed. Every unused package increases the security risk and it also needs some space.
A good example is an environment for compiling from sources.
$> yum groupinstall "Development tools" ... Transaction Summary ============================================== Install 25 Packages (+33 Dependent packages) ...
After compiling your source code you might want to get rid of the development tools:
$> yum groupremove "Development tools" ... Transaction Summary ============================================== Remove 25 Packages (+2 Dependent packages) ...
If you compare the number of dependent packages you recognize that 31 packages will unnecessarily stay on your system!
And here is the solution:
There is a nice plugin called “yum-plugin-remove-with-leaves” which does what it says to do.
$> yum install yum-plugin-remove-with-leaves
Now you can suffix a yum remove command with “–remove-leaves”, which will remove any unused dependencies along with the package.
If you want this behaviour by default you can modify “/etc/yum/pluginconf.d/remove-with-leaves.conf” and set “remove_always” to true:
[main] enabled = 1 #exclude_bin = 1 remove_always = 1
Taking our example from above you see the difference:
$> yum groupremove "Development tools" --remove-leaves ... Transaction Summary ============================================== Remove 56 Packages (+2 Dependent packages) ...
All the 58 packages that were installed are going to be removed!