LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 09: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, 11:28 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, PCLinuxOS
Posts: 590

Rep: Reputation: 73
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, 09: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, 01:13 PM   #4
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, PCLinuxOS
Posts: 590

Rep: Reputation: 73
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:10 AM
Configuration original kernel Zolex Debian 4 10-31-2006 07:36 AM
FC4 original yum.conf? BiLLie- Fedora 7 07-20-2005 05:31 PM
restoring original sound configuration jax8 Linux - Newbie 0 02-19-2004 09:52 PM
yum configuration file headers problems akasantos Fedora 0 12-23-2003 01:03 PM


All times are GMT -5. The time now is 04:20 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration