Building a Raspberry PI Cluster – Part I: Hardware Acquisition and Assembly

Nowadays Linux runs on almost anything. You can get a cheap PC and turn it into a media station or web server or whatever else you wish at no additional cost. Hardware is cheap also. With the advent of the Raspberry Pi and similar small computer boards one can get a fully-functional PC for the price you’d usually pay for a sixpack of beer. In this LinuxConfig series we’ll not only build a Linux computer; we’ll build an entire Linux cluster with four nodes and learn how to manage it so that all the nodes respond at the same time to the same commands.

Hardware Requirements:

Motivation: why not?

To cover the motivation part we can answer the “why” with a simple “because we can” or “because it’s fun”. To take on a more practical approach, a Raspberry Pi cluster running on Linux is not only cheap to make compared to what it can do but can also be used to make one’s life easier when dealing with resource-intensive tasks such as compiling, continuous data parsing from the Internet or just learning how to manage a cluster using real hardware instead of resorting to virtual machines.

The Raspberry

A Raspberry Pi is a single board computer that took the hardware world by storm a few years ago. One of the latest iterations is the Raspberry Pi 3 B+, the one we’ll use in this tutorial. Going for about $38 on Amazon, the Raspberry Pi 3 B+ boasts a 1.4GHz 64-bit quad-core ARMv8 CPU with 1GB of DDR2 SDRAM memory. It needs an MicroSDHC or MicroSDXC card of at least 8 GB for storage and can also make use of an external hard disk drive through extension boards you can buy separately that connect SCSI to the main board’s parts, should you need more reliable and bigger storage.

The Raspberry Pi 3 B+ has one Ethernet port of 10/100Mbps Lan Speed, a built-in 4.2 Bluetooth module and a 802.11b/g/n Wireless module. The same board had 4 USB 2.0 ports, a full HDMI port, one 3.5mm audio jack that also acts as composite video. As a power source you can use the MicroUSB port to insert an 5V/2.5A DC adapter, use an USB cable connected to your computer or the built-in GPIO. It also has a CSI port for connecting a web cam and a DSI port for mounting a touchscreen display. This board uses only 5V to run, weighs 2.08 ounces and measures 3.54 inches in lenght. You can plug it in somewhere in your house just as you’d do with your smartphone when it needs charging and forget about it for months.

And it’s great for making a scalable Linux cluster with limited funds.

What you will need to build a cheap Linux cluster

In this how-to’s first part we’ll look at what you need to get in order to build your very own Raspberry Pi Linux cluster. Given the fact that the number of nodes you can use is scalable both upwards and downwards we’ll be building a four node cluster out of four Raspberry Pi 3 B+ boards. One can later add two, five, eleven more nodes if needed. The more Raspberry Pi 3 B+ boards you incorporate to the cluster the more power you’ll have at your fingertips.

First get four Raspberry Pi 3 B+ boards. It would be advisable to get them all at once or at least from the same seller in a short time span as to make sure they have the same build serial number, meaning they come from the same production line. This would ensure a similar experience with each board as each will behave in exactly the same way. A Raspberry Pi of the same model bought from another manufacturing time period might get just a bit hotter or run a bit slower than other boards of the same brand.

You need something to install sofware on, something that will act as a data repository for your software. MicroSD cards are cheap and you will need at least four 16GB MicroSDHC cards, one for each board. Once Linux is installed you will be left with approximately 11GB of free userspace – enough for you to experiment and deposit smaller files. Should you need larger storage you can get larger MicroSDHC or MicroSDXC cards; just make sure they’re all alike – same size, same brand.

You will need four MicroSD cards, at least 16GB in size

You will need four MicroSD cards, at least 16GB in size

For conectivity, given that each Raspberry Pi 3 B+ has an Ethernet port, you can buy five Cat6 Ethernet cables, at least one foot long (30cm). One for each cluster node and one to connect the entire cluster to your LAN or WAN. It’s best to use different colour cables. This way you’ll visually know which cable belongs to which node after you plug them in.

For power you have to use quality MicroUSB cables, nylon braided and colour-coded if possible. At times you might want to manually power down a node and then you’ll need to know which power cable belongs to which level of the cluster. Different colours make identification much easier than following the line with your fingers.

Try to get colour-coded Ethernet cables if you can, at least 30 centimeters in lenght

Try to get colour-coded Ethernet cables if you can, at least 30 centimeters in lenght

You also need something to make the cluster nodes talk to eachother. For this you can use a cheap 5-port switch like this one. It’s almost the same size as the Raspberry Pi 3 B+ boards and, with some adjustments, it fits nicely on the first level of the four node cluster. If you have a router at home you can use that to connect your new switch with the rest of the world. If not, you can get a small portable router with AP and 3G functions that – coincidentlly – has the exact same height and colour as the 5-port switch.

This switch fits almost perfectly in the rack and has 5 Ethernet ports

This switch fits almost perfectly in the rack and has 5 Ethernet ports

If you give the cluster resource-intensive tasks the Raspberry Pi ARM CPUs will get burning hot after an hour or so, even at room temperature. Compiling with GCC for 90 minutes will make each CPU reach 70-71 degrees Celsius (158-160 Farhenheit) so you’ll need to reduce that heat somehow. You can either get a cluster rack that already has 5V coolers installed or you can get coolers of your own, about 4 or 5cm in diameter and install them yourself with the aid of screws. A cooler will keep CPU temperature from rising above 50 degrees Celsius (122 Fahrenheit). If you also get some cheap heat sinks designed for the Raspberry Pi 3 B+ you can make the temperature drop a further 4 or 5 degrees Celsius (about 40 degrees Fahrenheit).

Cooling is important not only to protect your CPUs but also to make sure the cluster nodes process tasks at a decent speed. If you bought your own coolers and your cluster rack has none you will also need a bunch of 3mm screws, 4cm in lenght. To build the rack and set the Raspberry Pi boards inside so that they won’t move you will also need 2mm screws, about 1cm in lenght, four pieces for each of the four boards, 16 in total.

Cooling down your Linux Raspberry Pi cluster is very important

Cooling down your Linux Raspberry Pi cluster is very important

For powering the cluster you have to use a Power USB HUB. Also get some duct tape, as you will probably need it.

Make sure you get a good a Power USB HUB that is capable of delivering the 2,5 amps needed by each cluster node. It has to have a socket so you can plug it in directly into a power socket. The ones you see advertised as being able to deliver power directly from an USB port won’t do, as the Pi’s will either refuse to boot or report undervoltage.

Last but not least, buy a decent cluster rack for the Raspberry Pi’s. As stated above, you can either get one that already has coolers installed or one without coolers and you can later decide how and where to install them. Be advised, should you chose the latter, you will probably need longer brass spacers, exactly 4 centimeters in height, as this is the ideal space a cluster cooler needs to both be able to cool dowd a CPU and have enough space above it to grab air from. The rack is modular and you can add extra levels to it, but for now we’ll only need five: “ground floor” for the switch and the rest for each of the Raspberry Pi’s.

If you decide to mount your own coolers make sure you leave them enough space to grab cool air from

If you decide to mount your own coolers make sure you leave them enough space to grab cool air from

The switch can be fitted nicely on the rack's bottom shelf

The switch can be fitted nicely on the rack’s bottom shelf


The assembly part is rather self-explanatory. You need to take each rack plate and mount a Raspberry Pi 3 B+ board on it with the aid of the 2mm screws. Build each level, put the rack together with the help of brass spacers, install the coolers right above the CPUs if your rack has none by drilling holes in each acrylic rack plate and using the 4cm long, 3mm diameter screws so that the coolers are close to the processors.

Insert the power cables, connect each of the Ethernet cables to one LAN port on the switch and insert the MicroSD cards in their respective slots. Use the duct tape to keep the Ethernet and USB power cables nicely grouped together so that they won’t encumber you.

Once assembled, your future Linux cluster should look something like this

Once assembled, your future Linux cluster should look something like this


In the second part of this series we’ll start installing Linux on the cluster and go into operating system configuration and useful software installation, so stay tuned.

Building Raspberry Pi Series:

Comments and Discussions
Linux Forum