PDF download Download Article
A simple guide to uninstalling or removing RPMs with yum
PDF download 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

  1. Run "yum list installed" to see installed packages.
  2. Run "yum remove <packagename>" to uninstall a package.
  3. To also uninstall dependencies, use "yum autoremove <packagename>".
Section 1 of 5:

Uninstall a Package

PDF download Download Article
  1. 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]
    • 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.
  2. 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 .
  3. Advertisement
Section 2 of 5:

Uninstall a Package and Dependencies

PDF download Download Article
  1. This command not only uninstalls the package, but also deletes any dependencies you'll no longer need once the package is removed.
  2. 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]
    • Save the file.
  3. Advertisement
Section 3 of 5:

Uninstall Multiple Packages

PDF download Download Article
  1. To uninstall more than one package at a time with yum, type each package name after the "yum remove" command, separated by single spaces.
Section 4 of 5:

Uninstall a Group

PDF download Download Article
  1. 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]
    • Save the file.
  2. 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]
    • To see which packages will be removed when you uninstall the group, use the command yum groupinfo groupname . [5]
  3. 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" .
  4. Advertisement
Section 5 of 5:

Troubleshooting

PDF download Download Article
  1. error. You'll see this error if you try uninstalling a package that yum depends on, such as python or gawk. You'll also see this error if you try removing a package relied on by systemd, such as binutils.
    • Technically, you could uninstall a package required by yum using the command rpm -e --nodeps packagename , but you'll likely break things and wind up needing to reinstall yum. This is not recommended. [6]
  2. error. If you can't uninstall a package because of the "No match" error, the package name is incorrect, or you didn't install it with yum (for example, you compiled it from source).
  3. When you uninstall a package with yum, it only removes the software from the package—any configuration files or directories created by the software itself will remain unless you manually delete them .
  4. As yum requires python, it'll stop working if you remove python from your system. Unfortunately, there's not an easy fix, as the version of python that comes with your Linux system is the one yum relies on. Make a backup of your files and reinstall the OS.
  5. Advertisement

Expert Q&A

Ask a Question
      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!

      About This Article

      Thanks to all authors for creating a page that has been read 4,850 times.

      Is this article up to date?

      Advertisement