In my experience there is no single perfect solution for automated installation and backups. Every approach is usually quite customized to the needs and likes of the respective user. That said, I can only explain the way I handle things and hope you find some of the ideas useful...
There are several solutions for automation (like Chef, Ansible or Puppet) but for personal use (i.e. small scale) I prefer simple Shell scripts.
I think that there are four important categories that need automation/backup:
- configuration data (your dotfiles, application config, dconf settings, etc)
- applications (packages, additional repositories, other binaries etc)
- personal data (pictures, documents, music, books etc)
- security-relevant data (e.g. ssh keys)
I'll explain briefly how I handle each of those.
configuration data
I prefer to have this inside a version control system in order to easily track or undo changes if need be. I keep everything in a public GitHub repository and have some scripts to put them into place. Have a look at it and copy whatever you think is useful.
applications
In the same repository I have some scripts to install basic packages, add additional repositories or download other 3rd party applications.
personal data
I have a separate partition holding this kind of data. For some directories (like ~/Documents
) I create a symbolic link (can be automated with a simple Shell script). Furthermore you should have a backup of this stuff in another place, for example in the cloud (I'm using Google Drive & Dropbox) or on a external hard drive.
security-relevant data
Obviously you don't want to make this private stuff public nor trust it to a company like Google or Dropbox. So I just keep a backup on an encrypted USB drive or SD-card.
With these precautions I am able to re-install the OS and setup my environment in a couple of hours. Every time you do this you will find things to improve, so consider it a constant work in progress.
I hope you find this helpful, just ask if you want to know anything in particular. An of course I appreciate any feedback on how to improve this ;)