How to completely uninstall a package (including all extra files that came with it) using yum (or rpm)?

133,526

Solution 1

Check the Deleting packages with yum section in the HOW TO

There says:

In any event, the command syntax for package removal is:

   # yum remove package1 [package2 package3...]

As noted above, it removes package1 and all packages in the dependency tree that depend on package1, possibly irreversibly as far as configuration data is concerned.

As a quick way you can try:

yum remove package
yum install package

Also here is an interesting for. And the question can help you.

The one that keeps configs in a backup is rpm -e

What you can do is find out what is in a rpm using:

 rpm -ql packagename

or

rpm -qlp packagename if the package is not yet installed.

then, you can manually make the modifications you want.

Hope this helps!

Solution 2

rpm -e xxx.rpm && rpm -ivh --replacefiles xxx.rpm

This in effect replaces the old configs kept after "erasing" Must be a way to do this with yum and dnf

Solution 3

With root privileges, use

yum remove -y vsftpd
Share:
133,526

Related videos on Youtube

Howard
Author by

Howard

Updated on September 18, 2022

Comments

  • Howard
    Howard over 1 year

    When I do yum remove, it sometimes keeps a package's configuration files.

    Is there anyway to remove a package completely, without keeping any file that belonged to the package?

    I am running CentOS.

    • Anthony Bonney
      Anthony Bonney about 11 years
      Can you provide an example of configuration files are left after yum remove?
    • Howard
      Howard about 11 years
      ~/.mozilla left by firefox, for example
    • TusharG
      TusharG almost 9 years
      @ZaSter : When I removed quagga package it kept all its config files in /etc/quagga (Files like zebra.conf, ospfd.conf, bgpd.conf) which should have been removed along with package itself. If it is by design to keep them, then please provide a command that will also remove the configuration files.
  • Howard
    Howard about 11 years
    I guess it is probably impossible to remove all files that ever came with a package... but still your recommendation is helpful.
  • Tim Snow
    Tim Snow about 6 years
    doesn't work on RHEL7. /etc/sysconfig/<package> file is still there.