I want to reinstall a package on CentOS and start from scratch. In Debian, I can do a apt-get purge foo and it'll remove all config files for foo. yum remove foo doesn't remove the config files. Is there any way to do apt-get purge foo using yum?

  • 3
    Note that the only reason for apt-get purge is because apt-get remove leaves config. files in place, yum remove does not do that (they are moved to .rpmsave files if they have been changed, in fact it will even tell you it's doing so). Jul 22, 2009 at 18:45

3 Answers 3



yum remove package
yum install package

on command line. If there is any config file which is not replaced during installation then message will be printed on screen that the file has been saved with different name. Move new file to old file.

This is hoping there are very less configuration files of package which you are trying to re-install.

  • 8
    Not really. This does not remove config files
    – Bruno9779
    Jan 27, 2017 at 17:33
  • Does not print a message for me.
    – eckes
    Feb 6, 2018 at 18:26

Not terribly elegant, but it works:

for package in package1 package2 package3
  echo "removing config files for $package"
  for file in $(rpm -q --configfiles $package)
    echo "  removing $file"
    rm -f $file
  rpm -e $package

rpm -e <package-name> will do the trick if it's still available

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.