etckeeper allows the contents of /etc
be easily stored in
Version Control System (VCS) repository. It hooks into apt to automatically commit changes to
/etc
when packages are installed or upgraded. Placing /etc
under version control
is considered an industry best practice, and the goal of etckeeper is to make this process as
painless as possible.
Install etckeeper by entering the following in a terminal:
sudo apt-get install etckeeper
The main configuration file, /etc/etckeeper/etckeeper.conf
, is fairly simple. The main options being which
VCS and which package management system to use. By default etckeeper is configured to use
bzr for version control, apt for high level package mangement, and
dpkg for low level package management.
With the package installed, it is time to initialize the repository. In a terminal enter:
sudo etckeeper init
Next, commit the files to the repository:
sudo etckeeper commit "initial import"
Using the VCS commands you can view log information about files in /etc
:
sudo bzr log /etc/passswd
To demonstrate the integration with the package management system, install postfix:
sudo apt-get install postfix
When the installation is finished, all the postfix configuration files should be committed to the repository:
Committing to: /etc/
added aliases.db
modified group
modified group-
modified gshadow
modified gshadow-
modified passwd
modified passwd-
added postfix
added resolvconf
added rsyslog.d
modified shadow
modified shadow-
added init.d/postfix
added network/if-down.d/postfix
added network/if-up.d/postfix
added postfix/dynamicmaps.cf
added postfix/main.cf
added postfix/master.cf
added postfix/post-install
added postfix/postfix-files
added postfix/postfix-script
added postfix/sasl
added ppp/ip-down.d
added ppp/ip-down.d/postfix
added ppp/ip-up.d/postfix
added rc0.d/K20postfix
added rc1.d/K20postfix
added rc2.d/S20postfix
added rc3.d/S20postfix
added rc4.d/S20postfix
added rc5.d/S20postfix
added rc6.d/K20postfix
added resolvconf/update-libc.d
added resolvconf/update-libc.d/postfix
added rsyslog.d/postfix.conf
added ufw/applications.d/postfix
Committed revision 2.
For an example of how etckeeper tracks manual changes, add new a host to /etc/hosts
.
Using bzr you can see which files have been modified:
sudo bzr status /etc/
modified:
hosts
Now commit the changes:
sudo etckeeper commit "new host"
For more information on bzr see „Bazaar”.