How do you bootstrap new machines with your favorite settings?
I have a laptop, a desktop, both running Linux, and work desktop running Solaris. And I like to experiment with new distributions from time to time. I've started putting all my configuration files in ~/etc and symlinking into there (e.g. ~/.zshrc -> ~/etc/zshrc). But I have to remember to do all of the symlinking by hand each time I set things up on a new machine. I'd like to 'solve' this problem once and for all, my plans are:
- Track config in git (done)
- Write script that bootstraps my home directory.
- Create a VM with a fresh ubuntu install, and have it run the bootstrap script and run tests afterward (e.g. make sure emacs launches with no errors so no modules are missing, same for zsh, etc.). Setup a git pre-commit hook that boots up the VM, runs the bootstrap script and the tests.
- Somehow track all the packages I manually install after install. This is another big part of setting up a new box that I don't know how to automate well.
I have no idea how to go about doing #4, and I have no experience with VMs for doing #3 and don't know what complications are involved in scripting actions to take place inside a VM. Any tips or tricks or recommended VMs? (e.g. if setting this up would be easier in VirtualBox as opposed VMWare, etc.) Has anybody else tried anything like this? Is there a better approach?
Posted Jul 8, 2010, 5:52 PM UTC
apt-get probably has something that does this (I'm not 100% sure, I'm not a debian user). But the first portable version that I can think of is to do something like
ls /usr/bin > packagesright after you install (make sure to get all the other places too). Then track that file with git, and when you move to a new distro, get that file and do asort | diffand see what's missing.The problem with that technique is it doesn't distinguish packages pulled in as dependencies versus packages pulled in explicitly. If dependencies change I'll be pulling in unnecessary dependencies. I'm pretty sure there was a StackOverflow question about this with no good answer..