etckeeper allows the contents of
/etc to be stored in a Version Control System (VCS) repository. It integrates with APT and automatically commits 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 install etckeeper
The main configuration file,
/etc/etckeeper/etckeeper.conf, is fairly simple. The main option is which VCS to use and by default etckeeper is configured to use Bazaar. The repository is automatically initialized (and committed for the first time) during package installation. It is possible to undo this by entering the following command:
sudo etckeeper uninit
By default, etckeeper will commit uncommitted changes made to /etc daily. This can be disabled using the AVOID_DAILY_AUTOCOMMITS configuration option. It will also automatically commit changes before and after package installation. For a more precise tracking of changes, it is recommended to commit your changes manually, together with a commit message, using:
sudo etckeeper commit "..Reason for configuration change.."
Using bzr’s VCS commands you can view log information:
sudo bzr log /etc/passwd
To demonstrate the integration with the package management system (APT), install postfix:
sudo apt install postfix
When the installation is finished, all the postfix configuration files should be committed to the repository:
Committing to: /etc/
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/
Now commit the changes:
sudo etckeeper commit "added new host"
For more information on bzr see ???.