One of the earliest reasons to originally stir my interests in Bitcoin, was the notion of an immutable database or the Block Chain. A single source of shared truth, distributed and available to all to see; secured within a protocol really got my mind spinning. And although there are many novel methods being developed to fully harness the power and potential of Bitcoin, one cannot fully live and work within the Block Chain. The shear number of data structures and services that we depend upon in order to make up our Internet today simply cannot fit, presently.

Then I saw IPFS – and it made total sense.

Data, or content, cannot be lost. Content is parsed out on the network in a distributed fashion, as the Internet was originally envisioned and meant to be.

I suspect if you are reading this blog, you too see the value in this incredible protocol: IPFS. So why a Raspberry Pi (RPi)?

My earliest memories online were with computers that have only a fraction of the computational horsepower contained within a RPi. So I wanted to see if IPFS, which is attempting to re-invent the Internet, could I use this protocol with only a modest computer. Oftentimes, software is made to work by throwing fistfuls of clock cycles until it is made to work. To me, this represents terribly wasteful programming practices.

I’m very happy to report, that this is not the case with IPFS. The code that makes up this protocol is tight and right. It just works.

Another reason for the RPi, IPFS is aiming towards getting the Internet back on track at being truly distributed. Distributed in my mind implies access to all, not just those that can afford a powerful computer. At $35, a RPi can be put into a lot more hands than a computer costing an order of magnitude more.

Ok, lets roll up our sleeves and have some fun.

Table of Content

Materials Needed

Raspberry Pi 2 (Why the 2?) This is the latest edition of this computer No need to worry about reworking memory configuration

Ethernet Cable or WiFi USB dongle

4 GB micro SD card The entire OS, IPFS, and software dependencies can all fit on a standard 4 GB card

Another computer to perform the initial setup of the Raspberry Pi 2 (RPi2)

Raspbian OS - Debian Wheezy

Overview of Steps:

Preparing the Raspberry Pi’s OS Software Installations Node.js GO Language IPFS – Protocol IPFS – WebUI

Getting Your Raspberry Pi Ready

Visit https://www.raspberrypi.org/ in order to procure a copy of the Raspbian OS image file. Whilst you are downloading the image file, read through the install guides to learn how to get the image onto your micro SD card. You will need another computer in order to perform these steps of installing the downloaded image file onto the micro SD card. Once the card has had the OS installed, remove and install into your RPi2. Make sure that your Pi is connected to the Internet, for this tutorial we will assume that the computer is directly connected to a router via an Ethernet cable. Upon booting up for the first time, there are a number of configurations and localizations necessary to make your RPi2 work as your expect it. For the remainder of this tutorial, I will be assuming a RPi2 that will be used in the USA. Please, where needed, make changes to your location. You will be presented on initial startup a window containing various configurations/localizations. Before continuing, select the option to “Expand Filesystem”. This may take some time until you are told that, “Root partition has been resized”. Next comes localization of your RPi2 or “Internationalisation Options”. The RPi2 is configured to UK options that may or may not ideally suit your needs. Under “Internationalisation Options” “Change Locale” De-select the default using the spacebar. Select your option, assuming that you are in the USA – that would most likely be “en_US.UTF_8 UTF_8”. Select using your space bar and then TAB ENTER to save. When presented with “Default locale for the system environment”, select your previous choice. “Change Timezone” The RPi does not have an internal clock, rather it grabs the time off of a server after reading from a configuration file what is the appropriate timezone. Hence, this needs to be set in order for your Pi to operate correctly. “Change Keyboard Layout” This is by far the most important setting; failure to set this correctly may result in improper key mappings. Under “Keyboard layout” -> “Other”; again we want to de-select the default UK settings. Select “English (US)” and defaults are most likely ok. Again, if you are not USA, select the most appropriate settings. “Overclock” Though not needed, I do think that some overclocking is perfectly fine. “Modest” to “Medium” can be, typically, safely applied without stressing the Pi too greatly. “Advanced Options” Enabling of “A4 SSH” will allow for remote log in at a later time. This may be useful if you wish to run a headless system, i.e. a Pi without a monitor/keyboard, using a different computer. To save these configurations TAB to Finish and allow the system to reboot. The Pi will reboot in the command line. We did not configure it to boot into the graphic user interface (GUI), as next steps of updating the system does not require the overhead associated with running the GUI or gooey. The default credentials will be login – “pi” and password – “raspberry”. Within the terminal window enter the following commands and allow for each to fully run: >sudo apt-get update <enter> >sudo apt-get upgrade <enter> >sudo apt-get autoremove <enter> >sudo ldconfig <enter> >sudo reboot <enter> Each of these commands will result in the Pi performing various housekeeping activities. After the computer restarts, you may now want to start in the GUI environment, instead of the command line. To change this setting, enter: >sudo raspi-config The configuration window again appears and you can “Boot into the Desktop”. It is also a great idea at this point to change the default password at this time. Again reboot the computer and you should now have started up in the graphical user interface.

Installing Node.js

Node.js is required for later installation of the IPFS WebUI components. Although this can be installed after the install of IPFS, it doesn’t hurt to perform this install right away to get it out of the way. Use the following guide to installing this software: http://weworkweplay.com/play/raspberry-pi-nodejs/ You will see the initial download as:

After the download, the package must be installed. Within the terminal issue the following command:

>sudo dpkg –i node_latest_armhf.deb

This will begin the unpacking and installation of the software. Double check that node is installed properly by issuing the following terminal command:

>node --version You should see it return the version of node that you have running:

After installation of node, it is best to reboot. ( >sudo reboot )

Installing the Go Language:

The Go language is used by IPFS and its installation is required. There are a number of great tutorials explaining how to install the GO language on the Raspberry Pi, such as: http://dave.cheney.net/2012/09/25/installing-go-on-the-raspberry-pi Great tutorial Complete and useful for troubleshooting. http://blog.meinside.pe.kr/Gogs-on-Raspberry-Pi/ Great resource Also a great troubleshooting tool https://xivilization.net/~marek/blog/2014/07/05/go-1-dot-3-for-raspberry-pi/ This is the tutorial that we will be using for the present tutorial By far the quickest setup towards installing GO on your Raspberry Pi Launch the tutorial on your Raspberry pi, this will permit copying/pasting of commands directly into your terminal window:

Using the mouse, select one line at a time from the website and then right mouse click “Copy”. In a terminal window, right mouse click and select “Paste” to enter the command. Do this for the four lines shown. You will see the RPi begin the process like such:

After this process is complete, verify the install by checking its version. Type in the terminal window:



>go version <enter>

Installing the IPFS (Protocol)

We will be installing the protocol first. Go to IPFS.io and then select the link “Install IPFS”

Download the link for the “Linux ARM” into your Downloads folder (automatic). Once the download is complete, double click on the compressed file in order to extract.

Change the extraction path to your HOME directory:

Once extracted into your HOME directory, open a terminal window: Inside of the terminal window type:

>cd ipfs/dist <enter> (This is assuming that you extracted IPFS into a folder called ipfs in your home directory.) You must now move ipfs in order to be able to use it, type:

>sudo mv ipfs /usr/local/bin/ipfs <enter> Move will only be successful if you perform it as a super user, hence the “sudo” You should now be able to use ipfs from the terminal. To check, type:

>ipfs version <enter> The version of IPFS installed on your system should now be displayed. To begin using ipfs, we must initialize. Again in the terminal type:

>ipfs init <enter>

IPFS, on initial startup, will generate a 2048 RSA keypair and may take some time to perform this function. Next we must start the daemon. Within the terminal type:

>ipfs daemon <enter>

IPFS the protocol is now running on your RPi and can be used. You can directly add files, look at peers that are connected, etc. Refer to the manual pages to see what commands are available to you.

Installing the IPFS WebUI Front End