How to Uninstall a Yum Package?

In Linux, each major distribution working relies on a specific package manager, i.e., apt for Debian-based, Pacman for Arch based. Similarly, yum is also a package manager used to manage packages on CentOS, Fedora, or other RPM-based distributions. The packages handled by the yum manager are known as “yum packages”.

This article will mainly focus on uninstalling yum packages as they can free up valuable disk space on your system and help improve system performance. To do this, we will use CentOS 8 distribution that will include the following content:

Now, let’s get started by explaining the above in detail.

Listing All Packages

To uninstall a package, you must know which packages are currently installed on your system, and to do that, this yum command is used.

$ yum list installed

Look for the package you wish to uninstall and note its name.

How to Uninstall a yum Package Using the Autoremove Option?

The autoremove option can only be used when you alter the configuration file /etc/yum/conf. It is the most efficient way to uninstall a yum package because of the added functionality that removes the dependencies. To edit the configuration file, use your favorite text editor (we’ve used the nano editor) using the command in this format.

$ sudo nano /etc/yum.conf

As seen in the above image, we’ve set the value of “clean requirements on remove” to ‘1’ which means that this feature is now enabled and will remove all dependencies along with the package, save the changes, and exit. Let’s remove a package called ‘vsftpd’ using the autoremove option using this command.

$ sudo yum autoremove vsftpd

The above-executed command removes the package with all its dependencies that other packages don’t use. Here you are to enter ‘Y’ when prompted to continue with the process, and in the end, you’ll see a message saying “Complete!” that indicates that it is uninstalled successfully.

How to Uninstall a yum Package Using the remove Command?

The remove command works the same as the above (autoremove option), but you can remove multiple packages using this format.

sudo yum remove Package1 Package2

For example, we’d uninstall the packages named “Firefox & vsftpd” using this command.

$ sudo yum remove firefox vsftpd

The above image shows the uninstalling of multiple packages (firefox & vsftpd) along with the unused dependencies, and you are to enter ‘Y’ when prompted to continue with the process.

How to Uninstall a yum Package Using the erase Command?

The two methods to uninstall a yum package can only remove the package and its dependencies, but if you want to remove the configuration files, we will use the erase command like this.

$ sudo yum erase PackageName

Now, we’d remove a package called ‘samba’ along with all its dependencies and configuration files using this command.

$ sudo yum erase samba

The output doesn’t show any configuration files, but they’re removed. While executing the above command, you must enter ‘Y’ to continue the process.


Any installed package takes up disk space, which could become a headache when the drive is full; removing a few packages along with their dependencies and configuration files is a good idea. This article explains how you can uninstall a yum package.