Md. Obydullah Howdy, I am Md. Obydullah from Bangladesh. I love to write the article which may help others. It's my passion.

CentOS Remove Packages with Dependencies

Published on August 5, 2019 41 sec read

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.

The Methods

  1. YUM’s Autoremove Option
  2. Using Plugin

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 clean_requirements_on_remove=1.

[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:

sudo yum remove httpd --remove-leaves
The article is over. Thanks for reading. 🙂

Md. Obydullah Howdy, I am Md. Obydullah from Bangladesh. I love to write the article which may help others. It's my passion.

Leave a Reply

Your email address will not be published. Required fields are marked *