linux poison RSS
linux poison Email

Keed track of Configuration file changes under /etc - etckeeper

etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades. It tracks file metadata that revison control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It's quite modular and configurable, while also being simple to use if you understand the basics of working with revision control.

etckeeper installation:
Open your terminal and type following command to install etckeeper:
sudo apt-get install etckeeper
After the installation etckeeper will add all the files under /etc into its default repository (bzr), The main configuration file, /etc/etckeeper/etckeeper.conf, is fairly simple. The main option is which VCS to use. By default etckeeper is configured to use bzr for version control.

Configure etckeeper:
Open /etc/etckeeper/etckeeper.conf in your favorite text editor. The first option that you need to look at is VCS, which is the version control system you want to use. By default it’s set to bzr, but you can change it to other depending on your preference.

Another option that you may want to look is AVOID_COMMIT_BEFORE_INSTALL. By default, etckeeper will automatically commit any pending changes when you install packages. You can disable it by setting AVOID_COMMIT_BEFORE_INSTALL to 1. Also set AVOID_DAILY_AUTOCOMMITS to 1 for avoiding daily auto commit.

Using etckeeper:
First create a repository for etckeeper using following command:
$ cd /etc
$ sudo etckeeper init
$ sudo etckeeper commit "First Commit - by Nikesh on 6/12/2011"
Now, if you want to know what all files are modified and are not committed, you can use following command:
sudo bzr status /etc/
From here, using etckeeper is not different from using the version control system you selected. Let's say you want to change your apache config; you can edit the file and then commit it as usual:
$ cd /etc
$ sudo etckeeper commit -m "Changes made in apache2 config file - added port"



0 comments:

Post a Comment

Related Posts with Thumbnails