| by Arround The Web | No comments

How to Uninstall a Yum Package

As a sysadmin, one obvious task is handling the packages, from installing to uninstalling them. When you want to install, update, remove, list, and track the different installed packages on the system, you must use a package manager for that particular distro.

Yum is the package manager tool for handling the packages in Red Hat Enterprise in Linux. There are different ways of uninstalling a package using the Yum package management tool. Take a look!

Uninstalling Packages Using Yum

When working with Linux, installing packages is inevitable. There are packages that you install to achieve a given goal and after that, you no longer need them. Still, some packages come preinstalled in your distribution. When you don’t need the packages, you can decide to uninstall them and their dependencies.

Different Linux distributions have different package management tools. CentOS and other RPM-based distributions can utilize Yum to uninstall the packages.

Here’s the syntax to uninstall a package using Yum:

yum remove [package_name]

or

$ yum erase [package_name]

The erase or remove command uninstalls a package and a few of its dependencies. When it resolves the dependencies like in the following output, press y to complete uninstalling the package.

The erase command also achieves the same result.

When you don’t remember the package’s name that you want to uninstall, you can list all the installed packages using the yum command:

$  yum list installed

Alternatively, you can filter the search using the grep command:

$  yum list installed | grep package-name

Suppose you wanted to remove multiple packages simultaneously and list their names separately. Here’s an example:

$  yum erase package1 package2 package_n

Using Autoremove with Yum

The autoremove option is added when you want to uninstall a package and all its dependencies. With Yum, we must first edit its configuration file for the autoremove option to work.

Open the yum.conf with an editor of choice and add the following line to the configuration file:

$  vi /etc/yum.conf

Add this following line:

directive clean_requirements_on_remove=1

Save and exit the file.

The next time you uninstall a package, Yum will automatically uninstall all its dependencies without you specifying the autoremove option as shown in the following example:

Uninstall a Package Group

Most packages exist as a group, so you can install all the required packages when you want to use a given tool.

If you’re unsure of the group that you want to uninstall, use the yum groups list command to display a list of all the available package groups in your system.

$  yum groups list

Once the available groups are listed, you can further analyze the available packages under them to know the ones that will get uninstalled when you erase the group.

Here’s how to list the packages inside a group:

$  yum groups info “group-name”

Suppose we wanted to remove the Scientific Support group. We could list its packages as follows:

Once you’ve confirmed the packages that will get uninstalled, remove the package group using the following syntax:

yum group remove “group-name”

or

$ yum remove @”group-name”

Yum uninstalls all packages in the specified group.

Conclusion

Yum is a package management tool for RPM-based systems. With Yum, you can uninstall a package and its dependencies or a package group and all packages under it. This post covered the steps for uninstalling a single package using Yum and how to specify the multiple packages with the same command. Also, we showed how to search for the package that you want to remove by listing all installed packages. We also showed how to automatically remove a package with its dependencies and concluded with uninstalling a package group.

Share Button

Source: linuxhint.com

Leave a Reply