a bramble of pi’s

0 Hardware

5 Raspberry Pi 3 cards
5 microSHDC 16 GB cards (class 10, 90 MB/s read speed)
5 basic USB-micro USB B cable
[Compact 10-Port USB Charger] Anker PowerPort 10

1 Get a Linux image on an SD card

We used Rasbian Jessie distro. Other options include the Ubuntu Server Standard 16.04 for Raspberry Pi 3 from Ubuntu Pi Flavour Maker, the official Raspberry Debian distro and Ubuntu Raspberry.

Write the image to an SD card; We used a Windows machine for this with  Win32DiskImager;  Linux and Mac instructions are also available. Download, extract the files and run as admin; select the iso file; select the drive where the SD card is (make sure it is the correct drive); click write and wait for the write to finish. This has to be done for all SD cards.

2 Boot up and make some configurations

For each Pi card, insert the SD card and power it. Update the system and install some required packages:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server build-essential cmake

Using the raspi-config tool, make sure you set the correct options:

  • change user password
  • boot options (GUI or CLI)
  • internationalisation options, in particular timezone and keyboard layout
    • advanced options: set the correct hostname, enable ssh server

Configure the IP addresses in each node by editing the /etc/network/interfaces file to look something like:

iface eth0 inet static
address 192.168.0.101
gateway 192.168.0.1
#this is the address of the internal card defined above
dns-nameservers 'some_dns_servers'

IMPORTANT: make sure all nodes are seeing each other by editing the /etc/hosts file to list all nodes:

127.0.0.1 localhost
192.168.0.101 rasp01
192.168.0.102 rasp02
192.168.0.103 rasp03
192.168.0.104 rasp04
192.168.0.105 rasp05
[...]

Also make sure that in each node the correct hostname is assigned (check the /etc/hostname file).

Configure passwordless ssh, as the user that will run the cluster; on each node:

ssh-keygen -t rsa
#copy it to each of the other nodes:
ssh-copy-id @

3 Configure Samba

By configuring a samba server, all machines can be brwosed from the internet.

4 Configure NFS

At the head node:

sudo apt-get install nfs-kernel-server
sudo cp /etc/exports /etc/exports.back
#add to /etc/exports on head
/home/ubuntu *(rw,sync,no_subtree_check)
/apps *(rw,sync,no_subtree_check)
sudo exportfs -a
sudo service nfs-kernel-server start

At the compute nodes:

sudo apt-get install nfs-common

On all machines:

sudo mkdir /apps
sudo chown -R ubuntu /apps

sudo ufw allow from 192.168.0.101
sudo ufw allow from 192.168.0.102
sudo ufw allow from 192.168.0.103
sudo ufw allow from 192.168.0.104
sudo ufw allow from 192.168.0.105

sudo mount rasp1:/home/ubuntu /home/ubuntu
sudo mount rasp1:/apps /apps

#insert the following lines at the of /etc/fstab
sudo nano /etc/fstab
rasp1:/home/goncalo /home/goncalo nfs
rasp1:/apps /apps nfs

sudo mount -a

NOTES

locale was wrong for us, the default is en_GB, it had to be changed:

sudo localedef -i pt_PT -f UTF-8 pt_PT.UTF-8