How to uninstall packages using YUM command?

uninstall-yum-packages

In this article, we’ll learn how to uninstall packages using Yum. YUM is an open-source command-line package manager used by distros using RPM Package. It stands for Yellow Dog Updater Modified.

It is available on Red Hat Enterprise Limited(RHEL), CentOS, Fedora, OpenSUSE, etc which uses the RPM package manager. It is used for installing, updating, uninstalling, and querying packages.

Removing packages using the YUM command removes the package along with its dependencies but some dependencies are not removed. In this article, we will be discussing how to uninstall packages using the YUM command along with its dependencies.

You will need sudo privileges i.e. root access for performing the following operations. In this article, We are using Fedora 34 to run the Yum command.

Using the yum command to list all packages

For uninstalling packages, you need to know the correct package name. To list all installed packages, run this command:

yum list installed
uninstall packages using YUM

To search for a particular package, use the grep command:

yum list installed | grep <package_name>

Here, we have taken the package as Firefox here,

Yum List Installed Grep uninstall packages using YUM

To list all available and installed packages, run the following command:

yum list all
Yum List All uninstall packages using YUM

Uninstall packages using YUM

Now, we can find package names by using the above command. If you know the package name, you can uninstall a single package, multiple packages at once, or a group of packages using the following commands:

To uninstall a single package, run the following command:

sudo yum remove <package_name>
Yum Remove

To uninstall packages using YUM, Run the following command:

sudo yum remove <package_name1> <package_name2>
Yumremove Mul

Packages can be installed and uninstalled in groups by using the yum command. To uninstall a package group, for example, ‘Performance Tools’, Run the following command:

sudo yum remove @"<package_group_name>"

or

sudo yum group remove <group_name>
Yum Remove Group

uninstall packages using YUM along with dependencies

When a package is installed, some required dependencies are installed with it and stored. Uninstalling those packages also removes its dependencies unless used by any other packages. Some dependencies are still left unused. To remove those dependencies, Run the following command:

sudo yum autoremove <package_name>
Yum Autoremove

If you want to remove these dependencies using the yum remove command, You can follow this method:

First, open the yum.conf file with any text editor,

vi /etc/yum.conf
Vi Yum Conf

Now insert the following line at the end:

directive clean_requirements_on_remove=1

save and exit. Now all the dependencies will be removed using the yum remove or yum erase command without the autoremove command.

Yum Remove Dep

Conclusion

So, we learned how to uninstall packages using the Yum command. Yum is a great utility for distros using the RPM Package Manager. It is free to use. Yum works on the command line but using some tools, it can be given a Graphical User Interface.