All the work so far on creating a development environment, adding languages, apache, mysql, couchdb and nagios has been on a single CD card which was referred to as PiMaster which will form the coordinating node on my super computer.
Rather that duplicate everything 4 more times for each node, we can take a copy of the PiMaster SD card and burn it onto the 4 slaves.
First we insert the PiMaster SD card into my Macbook and use df to find the number of the disk it has been assigned
sudo diskutil unmount /dev/disk2s1 sudo dd bs=1m if=/dev/rdisk2 of=./PiMasterBackup.img sudo diskutil eject /dev/rdisk2
We now have an image PiMasterBackup.img on our hard disk, which we can copy onto the 4 slave SD cards, so we repeat the following steps for each CD in turn
sudo diskutil unmount /dev/disk2s1 sudo dd bs=1m if=./PiMasterBackup.img of=/dev/rdisk2 sudo diskutil eject /dev/rdisk2
However this gives us 5 copies of the same SD card which all have the same ip address, server name and configuration. We now need to personalise each SD card in turn.
Set aside PiMaster SD card as that is configured as we need it. At this stage don’t put power up its PI. For this next section we use one Pi on its own, and insert, configure and then eject each slave SD card.
Repeat these steps for each slave card
- Power down Pi ( if not already ), making sure no other Pi’s powered up
- Insert Slave SD Card
- Power up Pi which will appear on the network as PiMaster, ip address 192.168.1.200
- ssh pimaster
- sudo vi /etc/hostname
- Change the name to pislaveN, where N is the number of card, 1, 2, 3 or 4
- sudo vi /etc/network/interfaces
- Change the IP address to 192.168.0.20N, where N is the number of the card
- sudo vi /etc/hosts
- Change the the name pimaster to pislaveN
- sudo rcconf
- Turn off nagios3, move the cursor down and press space, this will remove the ‘*’ from between the square brackets ‘[ ]’
- sudo vi /etc/mysql/my.cnf
- Change the value for bind-address to the ip of the slave
- sudo vi /etc/couchdb/local.ini
- Change the ipaddress for bind_address to ip address of the slave
- sudo reboot
- You should now be able to ssh into pislaveN
Repeat for cards 2, 3 and 4