Installing IPFS & IPFS-Cluster on Raspberry Pi

Disclaimer: I worked at Protocol Labs (the company behind IPFS & IPFS-Cluster) for 6 months. I no longer work there.

I've been staring at my Raspberry Pi (RPI) for months now wondering how to make it useful. I have three RPIs and all are sitting around gathering dust.

Now, they all had purposes when I first bought them. One was a smart camera. Another was for playing with LEDs. Yet another was my personal server. But, with their original uses served - I am left flush with dusty RPIs.

So, I figured I should put them to some use. That's why I decided to make one of my RPIs an IPFS node. As an extra, I wanted to play around with IPFS-Cluster. Although the installs were for the most part straightforward, there were some gotcha's.

That's why I'm writing this article up. To save folks who want to get their RPIs running as IPFS nodes some time. And as an extra - insight on how to get IPFS-Cluster running.

Table Setting

Before we get started, this guide will not cover getting your RPI booted up with Raspbian. There are plenty of guides that walk through that today. You will also need to have this done before attempting the rest of this guide.

As an FYI, I'm using Raspbian Buster Lite (CLI only) in my install. To get the image onto my SD card, I used Etcher.

You'll also need to download Golang before getting starting. This is a straightforward install once you have Raspbian up and running. In your RPI's terminal use the following to install Go:

sudo apt update
sudo apt install golang

Once those downloads finish, you'll need to set your GOPATH. In my setup, I created a "go" directory in my $HOME directory (aka ~/) and set that as my GOPATH:

cd ~/
mkdir go
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'PATH="$HOME/go/bin:$PATH"' >> ~/.profile
source ~/.profile

Finally, you'll want to make sure you have Git installed on your system as well:

sudo apt install git

You should do a quick check on Go and Git with:

go version
git version

If they both return some output with version detail, then you're golden.

At this point you should be all set with the pre-requisite installs. Let's get onto the good stuff.

Installing IPFS

To install IPFS, I actually don't recommend using their documentation. RPIs are ARM devices (as of this writing) and there's potential for wonky interactions. The cleanest solution I've found is the ipfs-rpi repo created by claudiobizzotto.

Start by cloning the repo and changing into the directory:

cd ~/
git clone https://github.com/claudiobizzotto/ipfs-rpi.git
cd ipfs-rpi

Now you can use the install script in the directory to install IPFS:

./install

After running through the installation, you can check whether IPFS installed correctly with:

ipfs version

Installing IPFS-Cluster

To install IPFS-Cluster, I recommend installing from source. Start by cloning the ipfs-cluster repo and changing into the directory:

cd ~/
git clone https://github.com/ipfs/ipfs-cluster.git
cd ipfs-cluster

Now, you need to run two scripts:

go install ./cmd/ipfs-cluster-service
go install ./cmd/ipfs-cluster-ctl

Expect the first to take a while. This is due to the large number of dependencies that are being fetched. The second should install much quicker.

Once both install, check that everything works with:

ipfs-cluster-service version
ipfs-cluster-ctl version

VoilĂ ! You're now the proud owner of an IPFS (& cluster!)-enabled RPI node.

What's Next?

I recommend reading the "Getting Started" sections on IPFS & IPFS-Cluster. The easy win is to run the IPFS daemon (ipfs daemon) and get your RPI on the network. With one line, you'll be on the DWeb which is pretty cool.

But, the real fun starts when you think about how to use IPFS (a CDN) and IPFS-Cluster (an orchestrator) together.

Fun fact: I'm currently building a simple note-taking app using both. Stay tuned for more details on that!

Show Comments

Get the latest posts delivered right to your inbox.