Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
2  
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). –  James Antill Jul 22 '09 at 18:45
add comment

2 Answers

up vote 6 down vote accepted

Do

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.

share|improve this answer
add comment

Not terribly elegant, but it works:

for package in package1 package2 package3
do
  echo "removing config files for $package"
  for file in $(rpm -q --configfiles $package)
  do
    echo "  removing $file"
    rm -f $file
  done
  rpm -e $package
done
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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