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'm renting a slice (i.e., a VPS) from Slicehost. I've a spent a day or two filling up /usr with my favorite packages, /etc with configs and init scripts, and so on. Now I want to:

  1. save this whole setup somewhere (e.g., to load onto another machine).
  2. see what changes I've made to which files
  3. revert changes, tag revisions, and all that other good version control stuff

Saving a disk image gives me (1), but not (2) and (3).

Using Subversion (svn import / svn://someotherhost) might give me all three, but I expect problems if I actually try to check a project out into / and maintain .svn directories in root-owned areas. And to load my setup onto a fresh slice, I'd need to install an svn client on it first.

Is there a good way to do what I want to do?

share|improve this question
add comment

4 Answers

up vote 5 down vote accepted

I am assuming you are using one of the mayor distributions If I needed to do the same as you I would use git for everything related to config files (/etc, /usr/local/etc, etc) I would avoid to version bin files unless you are compiling your own packages.

And I would use the native package manager of each distribution to replicate the installation of the same package profile.

In the case of debian based distros this is really easy:

dpkg --get-selections | grep '[[:space:]]install$'| awk '{print $1}' > packages-installed

and then in the new system:

cat packages-installed | xargs sudo apt-get install

Regards

share|improve this answer
    
I really like this method. I think if you have an explicit version of your os, you really shouldn't have to version control that. –  Joseph Silvashy Mar 19 '10 at 6:31
    
One item I would add is to keep a permanent history of commands entered, so that you can always repeat the order of installation as well as what was installed. A different order could potentially create problems. –  John Gardeniers Mar 19 '10 at 12:11
    
I like the dpkg/apt-get trick! I think I will try this. –  Tom Mar 20 '10 at 19:57
add comment

I expect git or some other distributed vcs would do a better job at this then svn. You might want to look at the source for etckeeper which basically tracks /etc with git, and a couple other dvcs. Etckeeper could probably be extended or modified to track the entire filesystem.

share|improve this answer
add comment

I see two non-obvious solutions.

Backup using BackupPC, which lets you easily check out previous versions and restore them. Can be done remotely or locally.

Configuration management using puppet. I don't version control all the files on the server. I version control puppet modules and manifests which describe what changes should be applied to the server. I avoid touching the servers by hand at all, and if I do, I duplicate the changes in puppet.

I use both. Configuration comes from puppet, versioned with git and versioning of "user data" (served webpages, home directories etc.) is handled by backuppc.

share|improve this answer
add comment

You can put /etc into SVN. I would use a different backup method for /usr though.

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.