Download Article
A simple guide to uninstalling or removing RPMs with yum
Download Article
If you installed a software package on CentOS, Red Hat, or Fedora Linux using the yum package manager, uninstalling the package is easy. You'll just need to know the package's name and use an account with root or sudo privileges. This quick guide will show you how to uninstall a package using yum, with or without dependencies, and help you troubleshoot common errors.
Quick Steps
- Run "yum list installed" to see installed packages.
- Run "yum remove <packagename>" to uninstall a package.
- To also uninstall dependencies, use "yum autoremove <packagename>".
Steps
Section 1 of 5:
Uninstall a Package
-
Get the package name. If you're not sure what the exact name of the package is that you want to uninstall, there's an easy way to find it:
- To see a list of all installed packages , run yum list installed . However, this can be a lengthy list if you've installed a lot of packages. [1] X Research source
- To search for a package that contains a certain keyword, run the command yum list installed | grep keyword
.
- Replace keyword with anything that describes the package you're looking for.
- For example, if you're looking for a package related to BIND, you'd use yum list installed | grep bind to display all installed packages with "bind" in the name.
-
Run yum remove packagename to uninstall the package. For example, to uninstall BIND, run yum remove bind . Enter your password when prompted, press y , and then press Enter to uninstall the package with yum.
- You can also use yum erase packagename , as erase works the same as remove .
- If you're not logged in as root, you'll need to preface the yum command with sudo .
Advertisement
Section 2 of 5:
Uninstall a Package and Dependencies
-
Use yum autoremove packagename to uninstall a package and its dependencies. This command not only uninstalls the package, but also deletes any dependencies you'll no longer need once the package is removed.
-
Remove dependencies automatically (optional). If you want to automatically remove dependencies when you run the yum remove command instead of running yum autoremove every time, just make a quick change to /etc/yum.conf:
- Open /etc/yum.conf in any text editor, such as nano or vi.
- Add the line clean_requirements_on_remove=1 . [2] X Research source
- Save the file.
Advertisement
Section 4 of 5:
Uninstall a Group
-
Decide whether to remove all packages in a group, or just those not in use. When you uninstall a group with yum, you'll be uninstalling all packages in that group, even if a package is part of another installed group or a dependency of another installed package. If you only want to uninstall packages from a group that aren't required by other packages or groups, you'll need to edit /etc/yum.conf first:
- Use any text editor to open /etc/yum.conf for editing.
- Add groupremove_leaf_only=1 to the "[main]" section of the config file. [3] X Research source
- Save the file.
-
Use the command yum grouplist to view all installed groups. To uninstall a package group with yum, you'll need the group's name. This displays all package groups you've installed.
- For example, if you want to uninstall the KDE Plasma Workspaces group, the group name you're looking for is "KDE Plasma Workspaces".
- If you don't see the group you're looking for, use yum grouplist hidden to include hidden package groups. [4] X Research source
- To see which packages will be removed when you uninstall the group, use the command yum groupinfo groupname . [5] X Research source
-
Use yum groupremove groupname to remove the group. This uninstalls all packages that were installed with that group.
- If the group name contains spaces, surround it in quotes. For example, yum groupremove "KDE Plasma Workspaces" .
Advertisement
Expert Q&A
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
References
- ↑ https://access.redhat.com/sites/default/files/attachments/rh_yum_cheatsheet_1214_jcs_print-1.pdf
- ↑ https://linux.die.net/man/5/yum.conf
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-configuring_yum_and_yum_repositories
- ↑ https://access.redhat.com/solutions/15815
- ↑ https://docs.oracle.com/en/operating-systems/oracle-linux/7/yum/yum-YumGroups.html
- ↑ https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-rpm-uninstalling
About This Article
Thanks to all authors for creating a page that has been read 4,850 times.
Advertisement