ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Linux: Uninstalling Packages with RPM

    IT Discussion
    rpm linux centos fedora rhel suse opensuse sam linux administration
    1
    1
    1.3k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by scottalanmiller

      After installing packages, uninstalling them is the next most important task that we will do with the rpm command.

      To remove a package, we simply need to use the erase or "-e" flag. Here is an example:

      # rpm -e yum
      

      This will uninstall the first occurance of the yum package found in the database. Sometimes that is fine. Sometimes we might have different versions installed and need additional control. If you use rpm to query the system with rpm -q yum for example, we will know exactly what to put into the command:

      # rpm -e yum-3.2.29-69.el6.centos.noarch
      

      This is a bit more precise. Now considering that there might be multiple versions and perhaps we don't want to be precise and just want them all gone, we can address that, too. For this we will use the "--allmatches" flag like so:

      # rpm -e --allmatches  yum
      

      All versions and architectures of yum will be removed.

      Now, of course, just like when we are installing there is the possibility that there will be packages that depend on the one that we are removing. Be default rpm will protect us from removing something that is needed by something else in the system. We can, as always, override this if we really, truly know what we are doing!

      # rpm -e --nodeps yum
      

      Now when would we want to do this? A good example is when we need to remove one package now on which things depend and replace it with a different package that does something similar and those packages will happily use that as well. Examples of this are moving from MySQL to MariaDB or from Sendmail to Postfix.

      As always, these are the common flags that Linux admins should know. The documentation has many more for special cases.

      1 Reply Last reply Reply Quote 4
      • 1 / 1
      • First post
        Last post