How do I Uninstall a Yum Package?

Any Linux distro is a collection of numerous packages. To keep all of them in order, a suitable package manager is a must. Depending on what type of package the distro uses, the package manager differs. In the case of distros using the RPM package, yum is the package manager. It’s available on CentOS, RHEL, and other RPM-based distros (Fedora, and OpenSUSE, etc.). However, it’s mostly used on CentOS and RHEL.
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.

Prerequisites

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.

$ yum list installed

The output can be filtered using grep. For easier reading, you can pass it to less.

$ yum list installed | grep <search_term>

$ yum list installed | 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.

$ yum remove <package>

The same command structure works in case you want to uninstall multiple packages.

$ yum remove <package_1> <package_2>

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.

$ yum remove @"<group_name>"

Alternatively, use this command. It does the same job but the command structure is different.

$ yum group remove "<group_name>"


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”.

$ yum remove <package_name> -y

Final thoughts

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.

$ yum --help

Happy computing!



from Linux Hint https://ift.tt/37ayutL

Post a Comment

0 Comments