How to remove packages that are no longer needed on CentOS 5?
772
While installing package I get some additional packages on dependency. But when I remove installed package with yum, the dependency packages are not removed, though I don't need them anymore.
package-cleanup in yum-utils will give you a list of packages that are not longer used. It cannot automatically remove them though it would be simple to use the output in a script that did this.
You could also look into a yum plugin called remove-with-leaves. I have never used it so I'm not sure of its compatibility with the version of yum in CentOS 5. Also, people seem to have a lot of problems given the results of a quick google search.
With newer yum versions (>= 3.2.28-13 at least), and for more than 10 years now (since the end of 2010), you can use yum autoremove pkg and it will automatically take care of removing the unused dependencies.
package-cleanup in yum-utils will give you a list of packages that are not longer used. It cannot automatically remove them though it would be simple to use the output in a script that did this.
You could also look into a yum plugin called remove-with-leaves. I have never used it so I'm not sure of its compatibility with the version of yum in CentOS 5. Also, people seem to have a lot of problems given the results of a quick google search.
Check out "package-cleanup" in yum-utils (yum install yum-utils).
With newer yum versions (>= 3.2.28-13 at least), and for more than 10 years now (since the end of 2010), you can use
yum autoremove pkg
and it will automatically take care of removing the unused dependencies.