"IPFS" Inter Planetary File System & Webui using go-ipfs
Introduction
What I aim to do in this blog is reveal the necessary instructions in English to build and install IPFS on, in this case the Raspberry Pi Ver 3 SBC (Single Board Computer). However if you follow the steps provided being careful to select appropriate Operating System it should work certainly for Linux based computers.
Tools I used
- raspberrypi/downloads I used Raspbian Stretch Lite
(https://downloads.raspberrypi.org/raspbian_lite_latest) - etcher available from etcher.io
(https://github.com/resin-io/etcher/releases/download/v1.2.0/etcher-1.2.0-linux-x86_64.zip)
download the application appropriate for your system. - ipfs.io/docs/install select the download appriate to Install Go IPFS on your system I used arm for the RaspberryPi
(https://dist.ipfs.io/go-ipfs/v0.4.13/go-ipfs_v0.4.13_linux-arm.tar.gz)
Please use latest build - Howto Documents (https://ipfs.io/docs/getting-started)
- A Laptop or PC to flash the micro sdcard, and as a client to remotely connect to the Raspberry Pi to download, browse and select, copy as necessary links used to port onto the RPi.
Install the latest rpi-lite_build available from http://raspberrypi.org/downloads to a your micro sdcard I use Etcher it's quick and verifies the flashed sdcard. Then place sdcard in your Raspberry Pi.
I use etcher to install directly the zipped iso to a 8gb sdcard or better
Boot and login as usual as user "pi" with "raspberry" as the password (changing this later)
If you are using a wireless you will need to update your wireless configuration for your wireless access point with a valid password you can only do this step as root, "sudo" does not work, if you are using a ethernet cable you can skip this step.
Important do this first, if you are using wireless network
sudo su
then
wpa_passphrase AccessPointName AccessPointPassword >> /etc/wpa_supplicant/wpa_supplicant.conf
(Both AccessPoint & AccessPointPassword may be case sensitive) Best way is copy character by character including the spaces and special symbols ">>" all of which are necessary.
then test with
apt update && apt upgrade -y && apt install -y vim tmux screen git htop fuse && rpi-update
We have used "double &" to ensure the next command in the chain does not start until proceeding command has finished without error, as user root you do not use sudo (it's not needed) if you do get apt errors restart your wireless network device in the RaspberryPi or reboot as necessary.
then
raspi-config => 5 Interface Options => P2 enable ssh => yes (This is a console menu system only "raspi-config" is a command)
Edit /etc/config.txt in my case i used vim but you can use any you are familiar with
vim /etc/boot/config.txt
add the following at the bottom of the config.txt file on a new line
avoid_warnings=1
(For you reference do not type this line - This gets rid of the lightening bolt on the screen you sometimes seen mainly on Pi-top and Pi-top ceeds)
Reboot and login
Next login to your RPi via ssh using it's ip address in the following format from your Laptop/Pc this allows you to login to your RPi remotely. You can find your network address either from your connected router or typing the following command into your console (The console is your direct connection via HDMi normally not needed unless you don't know the network address for your RPi).
ifconfig
Switch to you Laptop / Pc terminal and using the address obtained -l = login and pi obviously is user pi
ssh aaa.bbb.ccc.ddd -l pi
or
ssh pi@aaa.bbb.ccc.ddd
should you prefer this method that's fine they are both exactly the same.
Via a Pc or laptop, as RPi is headless and is a lite build, navigate to ipfs.io/docs/install in your browser
type the url (Uniform Resource Locator)
https://ipfs.io/docs/install
Click the link for
Download IPFS for your platform (Button)
Then right mouse click "arm" along the same row for Linux binary and copy the download link
Select your ssh terminal to the RPi and type and paste the following
type wget then a space then paste what you hold in the clipboard it should look something like this.
wget https://dist.ipfs.io/go-ipfs/v0.4.13/go-ipfs_v0.4.13_linux-arm.tar.gz
this downloads the file then type the command below carefully select correct filename downloaded
tar xvf go-ipfs_v0.4.13_linux-arm.tar.gz
Use the current downloaded file whatever it is mine was go-ipfs_v0.4.13_linux-arm.tar.gz
then
cd go-ipfs
sudo ./install
then type the following
ipfs init
ipfs daemon &
Now the magic bit so pay attention
IPFS has been installed and is now running on you raspberry pi computer, you cannot access the webui at this point as it exist's on a remote computer. So tp get around this from a Laptop or Pc connected to the same network as the RPi we can use this clever little trick.
Open a NEW terminal on your Pc or laptop do this very important this step, this ensure's you not close the daemon already running, and that we setup previously.
ssh -L 5001:localhost:5001 aaa.bbb.ccc.ddd -l pi
If you followed all the above steps you will not need to be root (where a.b.c.d is the address on your network of your RPI)
What this does is to map your laptop/Pc localhost:5001 to aaa.bbb.ccc.ddd:5001 this is why you need to activate openssh-server in raspi-config earlier. So in your own chosen browser, chromium is fine on your laptop/Pc in the URL type localhost:5001/webui only you can access the user webui interface which should be on the same network as the RPi.
type in browser url
localhost:5001/webui
To add a directory return to the RPi terminal and type following for sake of argument
cd ~
mkdir data
copy your files and / or directories into this data folder
then
ipfs add -r data
Thanks, this is great!
Thanks Verena look forward to seeing your on blogs. I will do another blog myself soon.
Oh great just spotted a mistake relating to config.txt should read almost the same
Edit /boot/config.txt in my case i did
vim /boot/config.txt
add the following at the bottom
avoid_warnings=1 ## This gets rid of the lightening bolt on the screen you sometimes see mainly on pi-top ceeds
Reboot and login