Each Linux distribution is a collection of various packages. So, all packages must keep in a suitable package manager.
Different types of package managers are available on every Linux distribution. When we talk about CentOS then, using RPM is a package, and YUM is used as Package Manager.
YUM is available on almost all kinds of RPM-based environments like CentOS, Fedora, OpenSUSE, and RHEL. However, it is used on RHEL and CentOS distributions mostly.
To uninstall a particular package, as well as any packages that depend on it, run the following command as root : yum remove package_name.
Similar to install , remove can take these arguments: package names.
In this context, we shall look into how you can uninstall a program or package using the yum package manager on CentOS 8.
How to uninstall packages on CentOS Server ?
To make any system-level change in the Linux distribution, you must have sudo command or root privileges. In the CentOS environment, you need to login from a root account or any user who can execute sudo commands.
We will execute all commands we need to run on a command-line tool.
Therefore, open the terminal.
To do that, click on 'Activities' on top left corner and from the sidebar click on the terminal application icon.
Then, learn how to uninstall a package using yum on CentOS 8.
How to list the installed Package Using Yum Package Manager ?
Before uninstalling any program from your system, you need to know either this package is installed on this system or not.
You must have the package name that you want to uninstall from your CentOS 8 system. For this purpose, you need to list all installed packages.
Therefore, by executing the following command you can list all installed packages on your system:
$ yum list installed
For your convenience, you can use less with the above-mentioned command.
$ yum list installed | less
You can filtered the displaying output with the help of following 'grep' command:
$ yum list installed | grep <search_term>
For example, you want to search the gcc package. Just type gcc in the search term as follows:
$ yum list installed | grep gcc
How to Uninstall a Package Using Yum on CentOS ?
Now, we are assuming that you know about the package name that you want to uninstall.
So, using the following command you can uninstall the required package:
# yum remove <package>
For example, you want to remove a package with the name gcc.x86_64.
Then, you can remove it by using the following command:
# yum remove gcc.x86_64
How to Uninstall Multiple Packages on CentOS ?
By executing the same above command using the following structure, you can uninstall multiple packages:
# yum remove <package_1> <package_2>
For example, we want to remove two packages gcc.x86_64 and Firefox. Then, use the command as follows:
# yum remove gcc.x86_64 firefox
How to Uninstall a packages group from CentOS ?
Many similar kinds of packages you can install using the group package installation. So, if you don’t want to use it further then, you can also uninstall this group.
# yum remove @"<group_name>"
Let's give you an example, you can install a group 'Development tools' in which different packages related to development like gcc compiler, cmake, git and automake, etc are included.
So, by using just a single command you can uninstall the packages group:
# yum remove @"Development Tools"
Alternatively, you can use the below command that will perform the same operation that we have done in the above command.
# yum group remove "<group_name>"
How to Automate package removal confirmation prompt on CentOS ?
When you uninstall a package, it will show you a confirmation prompt. So, if you don’t want to view the prompt during the installation then, use the option ‘-y’ with your command.
# yum remove <package_name> -y
However, yum isn't the only one that offers this feature. Using this powerful manager you can perform more tasks.
So, execute the following command to explore more features of Yum package manager:
$ yum --help