Saturday, August 4, 2012

How To Use etckeeper in Ubuntu

etckeeper is a set of tools that allows you to maintain the /etc directory in a git, mercurial,darcs or bzr repository. This allows an administrator to commit changes once they have been reviewed.
sudo apt-get install etckeeper

Now the changes of the contents in the /etc directory will be stored in Version Control System (VCS) repository. The version control ties into the apt command to commit changes when packages are installed or updated.
The main configuration file is /etc/etckeeper/etckeeper.conf and provides the option of which VCS to use. By default etckeeper is configured to use bzr for version control. By default uncommitted changes are made daily. If this is not what you want you can edit the config file and uncomment AVOID_DAILY_AUTOCOMMITS configuration option.

Commit changes manually by using:
sudo etckeeper commit "reason for change"

bzr status /etc/
modified:
shadow

etckeeper commit "jane password"
Committing to: /etc/
modified .etckeeper
modified shadow
Committed revision 2.

bzr log /etc/shadow
------------------------------------------------------------
revno: 2
committer: root <root@ub11.localdomain>
branch nick: ub11 /etc repository
timestamp: Mon 2011-08-15 18:31:36 -0600
message:
jane password
------------------------------------------------------------
revno: 1
committer: root <root@ub11.localdomain>
branch nick: ub11 /etc repository
timestamp: Mon 2011-08-15 18:27:20 -0600
message:
Initial commit


Exercise:


Install etckeeper
sudo apt-get install etckeeper

Change jane's password.
passwd jane

Check the status of the change.
bzr status /etc/

Commit the change with a reason.
etckeeper commit "jane password changed by joe"

View the log of the changes.
bzr log /etc/shadow

Now install an application
apt-get install acl

Check for changes.

0 comments:

Post a Comment