JAW Speak

Jonathan Andrew Wolter

Recommended: etckeeper to keep all your server’s /etc in git (or bzr or hg)

with 7 comments

Reading time: 2 – 3 minutes

I’m using etckeeper to keep my /etc directory in version control (git).

When you make changes to a server, there are always risks. And even if you have a great backup strategy (I recommend backupninja), sometimes you change a config in the wrong way, which can ruin an otherwise great night. Why don’t we have an easy way to version control this very important configuration directory? (Ubuntu is working on it).

Here’s what $ sudo gitk will show you after a few changes in your /etc.
etckeeper with git

It’s no surprise that this comes from Joey Hess, who also wrote how to keep your life in svn. I was going to check into subversion all of /etc, but this has been a better experience so far: it has automatic hooks to do pre and post apt-get update commits. So you can more easily see what each package does to your configuration. Also, etckeeper takes care of permissions where svn can’t.

If you’re ready to install, here’s how you do it. I didn’t use the deb distribution because it is quite out of date, instead I pulled down the newest directly from Joey’s git repository.

$ sudo apt-get install git-core gitk
$ cd ~/
$ git://git.kitenet.net/etckeeper
$ cd etckeeper
( read the README and INSTALL files )
( possibly edit etckeeper.conf if you want to use bazaar or mecurial instead of git )
$ sudo make install  ( It's okay if it warns that bzr support not installed if you're not using it )
# sudo etckeeper init
$ cd /etc
$ sudo git status
$ sudo git commit -m "Initial checkin"

That’s it! Check out the README for day to day examples.

Whenever you use apt to install a program, it checks in any uncommitted changes, and then checks in the /etc after apt finishes. /etc is just a regular git repository (except for security permissions require using sudo), so you can also commit changes anytime you want.

Here’s another person’s take on etckeeper. New to Git? Check out Git for Computer Scientists.

Bookmark and Share

Written by Jonathan

November 23rd, 2008 at 1:52 am

Posted in code

Tagged with ,

7 Responses to 'Recommended: etckeeper to keep all your server’s /etc in git (or bzr or hg)'

Subscribe to comments with RSS or TrackBack to 'Recommended: etckeeper to keep all your server’s /etc in git (or bzr or hg)'.

  1. I think this is a fine approach for 1 or 2 machines. Once you want to scale this, I’d suggest Puppet to blast pre-existing configs out across your servers.

    Julian Simpson

    23 Nov 08 at 4:10 am

  2. Ah, yes, Puppet. Our IS department uses this, although I didn’t learn how to use it yet. Thanks for the pointer!


    23 Nov 08 at 11:53 am

  3. Did you redesign this blog? I think you did. looks good


    23 Nov 08 at 1:34 pm

  4. [...] at etckeeper or this tutorial for more information about keeping /etc in a git repo, but the answer to “Does Git change [...]

  5. Michael Kors Watches For Women…

    Recommended: etckeeper to keep all your server’s /etc in git (or bzr or hg) at JAW Speak…

  6. Moving Company Estimate…

    Recommended: etckeeper to keep all your server…

    movers web site

    26 Sep 17 at 1:56 am

  7. download film jurassic world bluray 720p…

    Recommended: etckeeper to keep all your server…

Leave a Reply