CentOS Remove Packages with Dependencies
Normally at the time of uninstallation a package, it just removes the package. There are some unused dependencies left. To remove a package completely, I’m going to share two methods.
Step 1 : YUM’s Autoremove Option
The clean_requirements_on_remove directive helps to delete unused dependencies. We have to add this to the yum config file. Open the yum config file:
sudo nano /etc/yum.conf
At the end of the file, add this line
[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=19&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release clean_requirements_on_remove=1
Now after removing a package, just run this command to remove the unused dependencies:
sudo yum autoremove
Step 2 : Using Plugin
Let’s install the plugin:
sudo yum install yum-plugin-remove-with-leaves
Now at the time of removing a package, we have to add this flag
--remove-leaves. Here’s an example:
The article is over. Thanks for reading. ?
sudo yum remove httpd --remove-leaves
Preview may take a few seconds to load.
Below you will find some common used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet
Bold & Italic
Bold **double asterisks**
Three back ticks and then enter your code blocks here.
# This is a Heading 1
## This is a Heading 2
### This is a Heading 3
> type a greater than sign and start typing your quote.
You can add links by adding text inside of  and the link inside of (), like so:
To add a numbered list you can simply start with a number and a ., like so:
1. The first item in my list
For an unordered list, you can add a dash -, like so:
- The start of my list
You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of , and the image URL inside of (), like so:
To add a divider you can add three dashes or three asterisks:
--- or ***