I received my new Raspberry Pi Model B board yesterday, and immediately started messing around with it (as you might expect).
Now I know that I might need to sometimes have to rebuild my installation on new SD cards, so I think it’d be good practice to store this in configuration format so it can be applied again to new builds.
Chef solo is good for doing server-less configuration management, as you can define all your apt package installations and configuration in one place, commit it to github and clone from it again when you need to set up your Raspberry Pi board again.
The steps I’ve taken to do this are:
First I resized my SD-card root partition to fill the entire flash space, and enabled the openssh-server so it can be connected to remotely. I found a good guide explaining these at:
Next I took an existing knife bootstrap for Ubunutu 10.4. Knife is a tool for managing cookbooks and installing Chef Client and Chef Solo to a remote host. A knife bootstrap is a script that is pushed to the remote host which performs the latter.
I found an issue with this bootstrap, as it turned out the SSH call it was performing wasn’t running login profiles, so wasn’t adding the sbin directories to the PATH environmental variable. It was an easy fix to do, as the “bash -c” at the start of the bootstrap file just needed changing to “bash -l -c”
With the modifications, it was (for me) just:
knife bootstrap -d debian6-gems -x pi --sudo <ip address of R-PI>
This will SSH into the specified IP address as the pi user, and run the bootstrap under sudo for root permissions.
Given that there is additional knife configuration files needed to work out the path that debian6-gems is located in, this could alternatively written with the exact location of the bootstrap file:
knife bootstrap -t /path/to/debian6-gems.erb -x pi --sudo <ip address of R-PI>
I’ve added that knife bootstrap to a github configuration repository, so you can run it yourself by doing the following on your PC (assuming you have ruby and rubygems set up already):
gem install chef # for the knife command wget https://raw.github.com/webtatic/configuration/master/chef/bootstrap/debian6-gems.erb knife bootstrap -t debian6-gems.erb -x pi --sudo <ip address of R-PI>