Build a DIY Supercomputer: Part 2!

Operating System Configuration

Lee Bardon
6 min readSep 5, 2020
My Odroid N2+ Cluster: Janky, homemade casing optional :)

Hello again! In PART ONE, we assembled the hardware and components needed to build a distributed computing cluster using readily-available single board computers (SBC’s). The Raspberry Pi is a popular choice of SBC, largely due to its extensive community, and associated instructional materials (check out Jeff Geerling’s fantastic site). However, I opted for the Odroid N2+, due to its superior performance.

In this article, we’ll get technical, and begin the process of transforming our lump of silicon, metal and children’s lunchbox lids, into a fully-fledged parallel and distributed computing workhorse!

1. Choose Operating System

Every computer needs an operating system (OS). An operating system is an essential tool for managing a computer’s memory and processes, and all of its software and hardware. It also allows us to communicate with the computer, without needing to be fluent in binary. The first thing you need to be aware of when choosing an OS for your nodes is that, in common with mobile devices, many SBC’s run on ARM processors and architecture. These are less powerful than e.g. the Intel processors found in desktops and laptops, but they also consume much less power, and generate much less heat. They are also much more diverse that a generic Intel/AMD architecture.

As such, they not only require an OS that has been compiled for use with ARM architectures, but ideally with your particular system. The manufacturer will typically have downloadable disk images available for your particular units, often in several ‘flavours’. In my case, I decided to use a Ubuntu MATE 18.04 image, which I obtained from Hardkernel (the manufacturer of the Odroid N2+ unit).

2. Flash SD Cards

The next step is to load the OS onto your microSD cards, for which you’ll need access to a laptop or desktop (NOTE: I opted for microSD cards for financial reasons; they aren’t super stable over time, so if you can afford it, eMMC cards, or even full external SSD hard drives, are the better option).

There are several ways to achieve this, but among the simplest is to use the excellent cross-platform, open-source utility Etcher, which will streamline the process for you.

Oooh, pretty!

Simply download your chosen OS image onto your laptop/desktop, insert the SD card and reader, fire up Etcher, and follow the instructions!

3. Configure Operating System

Once you’ve flashed the OS images onto your chosen storage devices, insert them into the respective slots on your SBC. Starting with your master node (choose either the bottom or top device for this, for ease), connect your ethernet cable and adjust the boot selector switch according to whether you’re using eMMC or microSD to boot.

For the master node, you should also connect the ethernet dongle to a USB port. I also connected my USB keyboard and mouse and HDMI cable, although it’s possible to SSH in from your laptop/desktop, assuming that the SBC is connected to your home network, and that you can obtain IP address (using your service provider’s network manager, or a scanning utility e.g. iNet).

If all has gone to plan, you’ll now be greeted with something like this:

Login screen! (emoji’s not included)

If you’re using the Odroid devices, you’ll typically have an initial default login of user: odroid, password: odroid. Go ahead and log in, and immediately open a terminal using Ctrl-alt-T.

Repeat After Me

The following processes will need to be performed separately on all of your nodes, with some slight variations in the case of the master node (the one you have plugged the USB ethernet dongle into).

The first thing we need to do, is obtain the hardware MAC address for each node; these will be needed for configuring our network (I’ll cover this in the next post in the series). In the terminal, issue the command ifconfig. You’ll be greeted with something like the following:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.116 netmask 255.255.255.0 broadcast 10.10.10.255
inet6 fe80::53e4:558:a0c9:211f prefixlen 64 scopeid 0x20<link>
ether 00:1d:06:42:52:bg txqueuelen 1000 (Ethernet)
RX packets 7207 bytes 816740 (816.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8593 bytes 5631670 (5.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 22

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1 (Local Loopback)
RX packets 152 bytes 11348 (11.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 152 bytes 11348 (11.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

I’ve highlighted the area where you’ll find the unit’s MAC address in bold. Make a note of this somewhere, and ensure that you know which unit this MAC address refers to. For the master node, you will also need the MAC address for the dongle. This will be found using the same command, in the block starting with eth1. It’s possible that your device will use names other than eth0 and eth1, but using the above structure, you should be able to work it out.

Next, install and run the Odroid Utility tool by entering the following four commands into your terminal:

>> sudo -s  >> wget -O /usr/local/bin/odroid-utility.sh https://raw.githubusercontent.com/mdrjr/odroid-utility/master/odroid-utility.sh>> chmod +x /usr/local/bin/odroid-utility.sh>> odroid-utility.sh

The first command, sudo -s, will drop you into root user/administrator. The second command, beginning wget -O, obtains the odroid-utility.sh shell package from its Github repo, and adds it to the /usr/local/bin/ directory on your machine. The chmod +x command sets the file permissions, to allow the shell script to be executed, and, finally, odroid-utility.sh runs the script. You should see the following screen:

Here, we want to perform three actions:

  1. Name the Node: Select the “Change Hostname” option. Name the node with the ethernet dongle master, and the other three worker1, worker2, and worker3. Note that you can call them whatever you want, as long as you’re consistent :)
  2. Turn off Xorg: In the next instalment of this series, we’ll cover network configuration, and will ultimately run these nodes ‘headless’. Thus, we don’t need the added overhead of a GUI that is launched by default. Turning Xorg to ‘off’ will prevent this from happening.
  3. Resize Root Partition: Whille flashing the microSD, we created the root file system with a 4 GB partition, meaning that there is unclaimed space on your drive. Using “Resize your root partition” will make available all remaining space.

Once we’ve completed the above, we’ll need to update the hosts file on each machine, to help make each member of our cluster visible. To do so, I use the terminal-based text editor Vim, which I wrote about on a previous blog. This doesn’t always come as standard, so you’ll have to:

>> sudo apt-get install vim 

As root user, open the hosts file using:

vim /etc/hosts

And adjust the contents of the file to the following:

127.0.0.1       localhost
10.10.10.1 master
10.10.10.2 worker1
10.10.10.3 worker2
10.10.10.4 worker3
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Finally, shutdown the node from the terminal using:

shutdown -h now

swap the keyboard, mouse and HDMI into the next machine, and repeat!

Once you’ve done all of the above for each node in your cluster, we’re ready to move onto the next stage: configuring the network to complete the set-up of your compute cluster, with it’s very own network backbone.

P.S. In the event that you get stuck with the above, please refer to the following useful resource. Until next time!

--

--