# Version control of linux configuration: /etc and installed packages

I search a software to track the changes made to linux server configuration.

# Goal

If there is something wrong with the server I want to see the last configuration changes.

# Needed features

• Keep /etc/ in version control
• List of installed packages and their versions. Needs to support dpkg and rpm.
• Auto-commit the changes every hour.
• Maybe: bash-History of user root.

# Not needed

• Configuration management: This is a different topic.
• Restore: I just want a history. Restore is done by hand or configuration management.
• For the first piece, etckeeper might be a good candidate. For packages, just a raw idea: dump package info before/after installs/updates/removals, diff the output, and put that into some repo (e.g. Apache with DAVSVN and auto-commit). For more specific recommendations, you'd need to add the package system used (RPM, DEB, …). – Izzy Jun 15 '16 at 11:12
• @Izzy yes, etckeeper looks nice. AFAIK it does not dump package info. For me this is a valid answer, if you write your comment as answer, I will upvote it. – guettli Jun 15 '16 at 13:24

For the first piece, etckeeper might be a good candidate:

etckeeper is a collection of tools to let /etc be stored in a git, mercurial, bazaar or darcs repository. This lets you use git to review or revert changes that were made to /etc. Or even push the repository elsewhere for backups or cherry-picking configuration changes.

It hooks into package managers like apt to automatically commit changes made to /etc during package upgrades. It tracks file metadata that git does 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 version control.

I've never used it myself,1 so I cannot say how well it meets your overall goal. As its description points out it hooks into package managers it might well be there is a way to cover tracking package changes as well. Worth noting, however: etckeeper is available via several distributions' repositories, e.g. for Debian and Ubuntu.

Further pointers worth checking:

1 I've just read about it in some blogs a while ago, which is how I know about it

• yes, etckeeper looks like the right tool.... Nevertheless I wait until accepting it. Maybe there are other tools with a different strategy. – guettli Jul 19 '16 at 8:23
• Fair enough. Though you can always move your "accept mark" to another answer, if a better one comes up – so you can't forget to accept anything :) – Izzy Jul 19 '16 at 8:25