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]
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
- 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.
➋ Now, write this code to uninstall the google chrome software package:
sudo yum remove google-chrome-stable
- remove: removes software packages.
- google-chrome-stable: package name.
In 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
- deplist: Command to check the package dependencies in Red-hat-based systems.
You 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
- autoremove: removes all other unused packages automatically.
sudo yum clean all
- clean all: cleans all metadata and cache files.
Now 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
- dnf: the latest version of yum that manages software packages in Red-hat Linux.
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
Related Articles
- How to Uninstall RPM in Linux [2 Simple Cases]
- How to Remove a Specific Version Using YUM [2 Easy Methods]
- How to Force Remove a Package Without Dependencies Using Yum [2 Methods]
- How to Remove and Purge a Package Using apt-get [4 Methods]
- How to Remove Apt-key in Linux [3 Practical Methods]
- How to Remove Package and Dependencies Using dpkg [4 Cases]
<< Go Back to Uninstall Packages in Linux | Package Management in Linux | Learn Linux Basics