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.
The 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 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
Software Engineer | Ethical Hacker & Cybersecurity...
Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.