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 by YUM 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.

Process flow chart to uninstall a YUM package:

describing the yum uninstall process

[Distro Used Throughout the Tutorial: RHEL 9.2]

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 gives better results 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.

1. Uninstall a YUM Package Without All Dependencies

Here, I will describe the detailed process of uninstalling the Google Chrome package. Packages have dependencies to function properly. In this case, the YUM package manager automatically removes the unused dependencies of the Google Chrome package. So follow the steps carefully:

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

    2. Now, write the following code to uninstall the Google Chrome software package:
      sudo yum remove google-chrome-stable

      OR,

      sudo yum erase google-chrome-stable
      EXPLANATION
      • remove: removes software packages.
      • erase: 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 packages with their dependencies, go through case 02.

Note: To forcefully remove YUM packages without dependencies, you can run this command:

sudo yum --setopt=clean_requirements_on_remove=0 remove google-chrome-stable

2. Uninstall YUM Packages With All Dependencies

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:

  1. 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 similarly. These unnecessary dependencies can minimize the space by occupying lots of storage space.

  2. Now, run the following command to remove all the unused packages and dependencies:

    sudo yum autoremove
    EXPLANATION
    • autoremove: removes all unused packages and dependencies automatically.

    removing all the dependencies in the system to increase performance speed

  3. Give permission to continue this process by typing ‘y’.giving permission to continue dependencies removing with yum command

  4. All the unused dependencies are successfully removed from the Linux system. Now, to delete metadata, and 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 Package With “dnf” (An Advanced Version of “yum” Command)?

DNF refers to dandified yum which is the same as the 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, the 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 the dnf command. Check the steps mentioned below:

  1. Open the Red-hat terminal.
  2. Write this code to uninstall the Google Chrome package:
    sudo dnf remove google-chrome-stable

    OR,

    sudo dnf erase 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.

Some Additional Options of “yum” Command

To have more control over the yum command, you can check this table that contains 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 the 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 the yum command. dnf is the latest command of yum with more features which is also explained here. Best wishes.

People Also Ask

How to uninstall a YUM package?

To uninstall a YUM package on a CentOS or Red Hat-based system, you can use the following command, sudo yum remove <package-name>.

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 the 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

5/5 - (11 votes)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
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