How to Uninstall a YUM Package [2 User-Friendly Cases]

In Red-hat-based Linux systems, YUM (Yellowdog Updater Modified) is a popular package manager for managing software packages. You might download some packages when you need them but now you may feel that those are no longer required and occupy your storage space. In that case, uninstalling that undesired software is crucial. You can use the yum command to do this task. In addition, there is another command which is dnf, the updated version of yum command, you can also use it to uninstall any package. Keep in touch to know more about the procedure in detail.

Key Takeaways

  • Learning about the features of YUM command.
  • Learning about how to uninstall packages using YUM.
  • Learning about dnf command.

Requirements

  • Must be a root user to have sudo privileges.
  • Must be registered in Red-hat-based Linux.

Process Flow Chart

[Distro Used Throughout the Tutorial: RHEL 9.2]

describing the yum uninstall process

2 User-friendly Cases to Uninstall YUM in Linux

It is the modern package manager that Red-hat-based distros like Fedora, CentOS, and RHEL use. With these distros, if you want to uninstall any package, utilize this command. dnf command is also included here that give better result than yum. Now, I will explain to you how to uninstall the google chrome package with these commands. Additionally, I will cover managing package dependencies.

Case 01: Uninstalling Packages without All the Dependencies with YUM Command

Here, I will describe the detailed process of uninstalling the google chrome package. Packages have dependencies to function properly. In this case, you may not want to remove all the package dependencies. So follow the steps carefully:

Steps to Follow >

➊  Check the location of the google chrome package. Write this code to find the package:

sudo yum list installed | grep google-chrome-stable.x86_64
EXPLANATION
  • sudo: Provides administrative privileges.
  • yum: Manages packages in Red-hat-based Linux.
  • list installed: Makes a list of all the installed packages.
  • | (pipe): Pipe operator that connects the output of one command to an input of another command.
  • grep Pattern: matches and prints text ‘Pattern’.
  • google-chrome-stable.x86_64: rpm package file of the google chrome installed in the Linux system.

Searching the google chrome package in the yum installed list

➋ Now, write this code to uninstall the google chrome software package:

sudo yum remove google-chrome-stable
EXPLANATION
  • remove: removes software packages.
  • google-chrome-stable: package name.

uninstalling google chrome package using yum commandIn this image, you can see that after typing y, the package will be deleted with unused dependencies as this single command alone can remove unwanted software packages with their unused dependencies.

However, if you wish to delete all other unused dependencies, go through case 02.

Case 02: Removing All the Dependencies of Packages with YUM Command

Some unused dependencies still may exist, therefore, use the ‘yum autoremove’ command, all the unnecessary dependencies of your Google Chrome package, as well as other packages, will be removed. Now, follow the next steps to do so:

Steps to Follow >

➊ First of all, check all the dependencies of the google chrome package by writing this command:

sudo yum deplist google-chrome-stable
EXPLANATION
  • deplist: Command to check the package dependencies in Red-hat-based systems.

checking dependencies with yum deplist command in LinuxYou can see all the dependencies of the google chrome package in this picture. By changing the package name, you can check other package dependencies in the same way. These unnecessary dependencies can minimize the space by occupying lots of storage space. Hence, run this command to remove all other unused dependencies.

sudo yum autoremove
EXPLANATION
  • autoremove: removes all other unused packages automatically.
removing all the dependencies in the system to increase performance speedGive permission to continue this process by typing ‘y’.giving permission to continue dependencies removing with yum commandAll the unused dependencies are successfully removed from the Linux system. Now to delete metadata, cache files, run this command:
sudo yum clean all
EXPLANATION
  • clean all: cleans all metadata and cache files.

This yum command cleans all the metadata and cachesNow you can notice in this image that 24 files have been removed from the Red-hat Linux including metadata and caches.

How to Uninstall a Package with dnf (An Advanced Version of YUM Command)

dnf refers to the dandified yum which is the same as yum command but a more updated one. It has several additional features than the yum command. However, people usually use yum as it is well documented, on the contrary, dnf command uses less memory storage and hence shows good performance and a better dependency resolver. If your device support dnf then go for it.

Now, I will show you how to uninstall the package with dnf command. Check the steps mentioned below:

Steps to Follow >

➊ Open the Red-hat terminal.

➋ Write this code to uninstall the google chrome package:

sudo dnf remove google-chrome-stable
EXPLANATION
  • dnf: the latest version of yum that manages software packages in Red-hat Linux.

uninstalling google chrome package with dnf command

Here you can see that like the yum command, this dnf command will also erase the google chrome package as soon as you type y. In the same way, you can do all the similar tasks as yum with this dnf command but with better performance.

Additional Options of YUM Command

To have more control over yum command, you can check this table contained some important options:

Command (short form) Description
– – install (-i) Installs packages.
– – refresh (-r) Forces a refresh of the metadata cache
– – force (-f) Forces the operation to proceed even if there are errors.
– – debug (-d) Enables debugging output.
– – upgrade (-U) Upgrades packages.
– – assumeyes (-y) Answers yes to all questions automatically.
– – quiet (-q) Suppresses output.
– – verbose (-v) Increases verbosity
– – config config_file (-C) Specifies a configuration file.
– – cachedir cache_dir (-c) Specifies a cache directory.
– – help (-h) Displays help information.

Conclusion

I hope now you can uninstall any package with yum/dnf command. In this article, I have covered how to uninstall packages with dependencies using the yum command. Also, you can remove all the unnecessary dependencies of your Linux system by reading this article. Moreover, you can check the dependency list with yum command. dnf is the latest command of yum with more features which is also explained here. Best wishes.

People Also Ask

What does yum erase do?
This command removes the specific package you chose. Don’t get confused with the ‘yum remove’ and ‘yum erase’ commands because they actually do the same thing and perform similar tasks.
What does yum reinstall do?
The ‘yum reinstall’ command reinstalls the exact version of the software that is already in place. The command syntax is ‘yum reinstall [package_name]’.
How do I stop yum from running?
Press Cntrl+C to stop running any command in bash terminal.
How do I undo the last yum install?
Run the “yum history undo” command with the precise “ID” number of the transaction you wish to go back to in order to undo an action.

Related Articles


<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics

Rate this post
Mitu Akter Mou

Hello, This is Mitu Akter Mou, currently working as a Linux Content Developer Executive at SOFTEKO for the Linuxsimply project. I hold a bachelor's degree in Biomedical Engineering from Khulna University of Engineering & Technology (KUET). Experiencing new stuff and gathering insights from them seems very happening to me. My goal here is to simplify the life of Linux users by making creative articles, blogs, and video content for all of them. Read Full Bio

Leave a Comment