Remove a package in AlmaLinux 9

Published: December 19, 2022

Last updated: December 19, 2022

Remove a package in AlmaLinux 9

In this article, we cover how to remove a package in AlmaLinux 9. In general, there are two methods which can get us any package installed in our Operating System -

  1. through repositories and,
  2. manually through rpm packages.

You would have noticed that a package rarely installs in isolation. There are plethora of dependencies which also get installed with any package. So, while removing a package we need to ensure that dependencies which were installed along-with the package are also removed.

Note: Following operations require superuser privileges. In case you don't have the required privileges then, contact your System Administrator for assistance.

Remove a package in AlmaLinux 9

dnf package manager is used to install, update and remove a package. Use the following syntax -

dnf remove <package-name>

For instance, if we want to remove Google Chrome package -

# dnf remove google-chrome-stable

At this stage, it would show us a list of all the packages which will be removed along-with the package we intend to remove. Such packages are the dependencies which even the package manager would state after we issue above command -

Removing unused dependencies:

If you are Ok with the removal process then Press y.

It is worth mentioning here that, same command can be used to remove packages which we have installed either through rpm packages or repositories.

But, there are times when unused dependencies do exist despite removing the packages from above mentioned command. Dependencies may remain in our system after we upgrade a package as the upgraded package may not require those dependencies anymore. Or, there could be other reasons. So, issue the following command to remove dependencies which are no longer required by any package :

# dnf autoremove

In conclusion, we have covered here how to remove a package in AlmaLinux 9. It is necessary that we remove packages and their dependencies which are no longer required. This would free up our systems' critical resources.