r/linux•
Jengu

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:

  1. Track config in git (done)
  2. Write script that bootstraps my home directory.
  3. 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.
  4. 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

06
Calvin_the_Bold•

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 > packages right 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 a sort | diff and see what's missing.

2
JenguOP•

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..

1
valadil•

I too have a bunch of dotfiles but they're in CVS. (Yes I could use something newer, but CVS has been doing this for years and I haven't seen compelling reasons to switch yet). CVS is willing to overwrite files in my home dir and I took the liberty of naming my project my username. So I don't have to worry about any additional symlinking. Have you considered making a script to symlink them for you? Alternatively if it's just shell rc files, you could have a simple .zshrc that sources the files in your version controlled folder.

I also keep a file listing debian packages I want on all my machines. Naturally this lives in my CVS dotfiles project. I used to have a .deb metapackage that installed my apps for me. It was way more complicated than it needed to be and didn't do anything the text file didn't.

2
TheAnimaL•

Puppet could be your friend here : http://www.puppetlabs.com/ . Would use something like FAI ( http://www.informatik.uni-koeln.de/fai/ ) , debootstrap or seedpimp ( which is not ready yet, 95% done, gonna be cool :-) ) for bootstrapping your VM's ( any VM with PXE boot would do ). Puppet controls your packages and configurations ( read the documentation on the website ), for all kinds of Linux distros, Solaris and other UNIXes. All of your puppet recipes could be tracked in git or svn. Works like a charm, just need a bit of spare time.. :-)

2
edogawaconan•

wrap apt-get or aptitude with a script to put whatever you did to a log file.

1