LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2011, 08:40 PM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Using yum to get an original configuration file


I have changed several configuration files in programs installed with yum, and since I've long forgotten exactly what changes I made I'd like to compare the current modified state of these files with the original state of the files as they were when I originally installed them.

I am wondering if there is a way to, rather than reinstall a whole program, just use yum to specify a file I'd like to retrieve in its original form from the yum repository?

(e.g. maybe something like... 'yum restore mysqld /etc/my.cnf /tmp', which for example would retrieve the original /etc/my.cnf from the mysqld package and put it in /tmp for me to examine)

I'd really like to be able to examine the original state of several configuration files in a clean and simple way rather than having to backup my changed configuration files, uninstall the packages, reinstall them to get the original files, then when I'm done with my comparisons restore my changed config files on top of the original ones to get back to where I was.
 
Old 10-27-2011, 10:28 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
You can use this to verify all the files in the package. The first 9 characters on each line are documented in the man rpm page under Verify Options. If any file's content is changed, it's MD5 sum will have changed, so the third column will be 5.
Code:
rpm -Vv mysql
The rpm command (and therefore yum) is very good about not overwriting configuration files you've modified. Instead, the new files are installed as file.rpmnew.

In fact, right now, issue this command. If you've updated almost anything, you're likely to have a few new config files.
Code:
ls /etc/*.rpmnew
 
Old 10-28-2011, 08:42 AM   #3
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Original Poster
Rep: Reputation: 16
I ran 'rpm -Vv mysql' and didn't see any files that have changed. I'm surprised because I'd expect /etc/my.cnf to show up, because I changed it. I also am not seeing any files when I do 'ls /etc/*.rpmnew'. I even did a 'locate *rpmnew' and nothing appeared.

Is there any way using either yum (preferrably) otherwise rpm to easily get at an original configuration file?
 
Old 10-28-2011, 12:13 PM   #4
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
The mysql package doesn't have any files in /etc/, but mysql-server does.

Quote:
Originally Posted by veeruk101 View Post
Is there any way using either yum (preferrably) otherwise rpm to easily get at an original configuration file?
A while back I put some effort into finding a way to do this. I found the repoquery command (in the yum-utils package) that lists the contents of a package (even if not installed), but I have yet to find a command that will actually allow me to see one individual file in a package.

Of course, you can always download the rpm file itself from the repo (with wget, curl or a browser) and then use something like this to extract and compare a file. I don't know if I have the syntax right. I didn't run this command and I'm not very familiar with cpio.
Code:
rpm2cpio mysql-server*.rpm | cpio -i /etc/tempfiles.d/mysql.conf | diff - /etc/tempfiles.d/mysql.conf
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix configuration: Final-Receipient different than Original-Recipient BeauSanders Linux - Server 1 10-26-2007 10:10 AM
Configuration original kernel Zolex Debian 4 10-31-2006 06:36 AM
FC4 original yum.conf? BiLLie- Fedora 7 07-20-2005 04:31 PM
restoring original sound configuration jax8 Linux - Newbie 0 02-19-2004 08:52 PM
yum configuration file headers problems akasantos Fedora 0 12-23-2003 12:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration