This guide showcases how to uninstall a yum package.
Uninstall yum packages
Uninstalling a package is one of the fundamental functionalities a package manager has to provide. In the case of yum, it comes with a handful of ways to uninstall a package. Note that these are RPM packages that yum is uninstalling from the system.
In this guide, I’ll be using CentOS 8.2 to demonstrate the methods.
To perform any system-level change on any Linux distro, you need to have sudo privilege or root access. In the case of CentOS, you need to have access to the root or any other user that can run sudo commands.
By default, CentOS disables sudo privilege to all the users (except root). Here, I’ll be logging in as root to perform the actions.
Uninstall package using yum
List installed packages
Before uninstalling a package, first, you need to know the package name. The following command will list all the installed packages.
The output can be filtered using grep. For easier reading, you can pass it to less.
Basic package uninstallation
This is the very basic way of uninstalling a package using yum. Assuming you know the package name to uninstall, run the following command.
The same command structure works in case you want to uninstall multiple packages.
Uninstall package group
Grouping is an interesting feature that yum comes with. Just like you can install all the packages under the same group, you can also uninstall them.
Let’s break it down with a quick example. The group “Development Tools” includes all the necessary tools for software development. It includes packages like gcc, automake, cmake, git, etc. Just like installing a group, yum offers a way of uninstalling a group as well.
To uninstall a group, run the following command.
Alternatively, use this command. It does the same job but the command structure is different.
Automate removal confirmation prompt
Whenever removing any package/group, yum will ask for confirmation. If you don’t want to face the prompt, then you can use “-y” to answer “yes”.
Uninstalling packages on yum is quite simple. All it requires is the name of the target package and root privilege. However, this isn’t the only feature yum offers. It’s a powerful package manager that can do lots of things.
For a quick review of what yum is capable of, check out the yum help page.