Setting up My Raspberry Pi Cluster

I posted earlier about setting up my first Raspberry Pi. This was a trial run for setting up a small cluster of five raspberry pis. To make life simple, I used the same steps to get berryboot and an OS on the other 4. This took a bit longer than some options, but with only 5 boxes wasn't too much work.

Next I wanted to set host names for the cluster so that I could find them. My plan was to name the pis, rpi0 - rpi4. I found this useful tutorial. To summarize the steps.

  1. Edit the /etc/hostname file, replacing the default name raspberry with the new name rpi0.

  2. Edit the /etc/hosts file, replacing the default name raspberry with the new name rpi0.   localhost
    ::1     localhost ip6-localhost ip6-loopback
    fe00::0     ip6-localnet
    ff00::0     ip6-mcastprefix
    ff02::1     ip6-allnodes
    ff02::2     ip6-allrouters   rpi0
  3. Reboot.

    > sudo reboot

I followed these steps on my first box, and got the name to be rpi0. But I still wasn't able to connect from my laptop since I don't have a DNS server running on my LAN. After some Googling I found this article on setting up bonjour/zeroconf on the pi. Basically this involved making sure the pi was up to date and installing a single package:

> sudo apt-get update
> sudo apt-get install libnss-mdns

Once that was installed, I could access my first pi using rpi0.local.

> ping rpi0.local
PING rpi0.local ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=54.703 ms
64 bytes from icmp_seq=1 ttl=64 time=64.260 ms

This also meant that I can ssh to the box using ssh pi@rpi0.local, which is really nice.

Using this info for the other 4 pis, I got them booting, ssh'd and:

> sudo apt-get update
> sudo apt-get upgrade
> sudo apt-get install git-core vim python-dev python-setuptools libnss-mdns

Then setup the host names. A few minutes later the cluster is up and running as rpi0, rpi1, rpi2, rpi3 and rpi4.

Hopefully in the next post I can do something more interesting ;-)

linux raspberry pi