Solid Pod Server Creation on a Raspberry Pi

SOLID POD SERVER CREATION ON A RASPBERRY PI

Raspberry Pi Solid Pod Server
A Raspberry Pi is able to run a Solid POD Server continuously and completely silently without getting hot, and cost less to run than an ordinary light bulb.

Solid POD Server Creation on a Raspberry Pi with easy to follow step-by-step instructions for non-technical users.

This page explains the process of Solid POD server creation on a Raspberry Pi 3 Model B+ in your own home.  Installation on any other Linux based machine should be similar.

The Raspberry Pi 3 Model B+ cost less than £50 and came with the following standard specification:

  • Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
  • 1GB LPDDR2 SDRAM
  • 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE
  • Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)
  • Extended 40-pin GPIO header
  • Full-size HDMI
  • 4 USB 2.0 ports
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • 4-pole stereo output and composite video port
  • Micro SD port for loading your operating system and storing data
  • 5V/2.5A DC power input

The Raspberri Pi requires an 8GB SD card to hold the operating system, and I used a 64GB SD card to hold the operating system and to leave plenty of room for files I may wish to download into my POD.

USING CODE IN A TERMINAL

Solid POD Server Creation requires use of a terminal in which you will be typing code.  Some of you reading this may be unfamiliar with typing code, so I will explain things in easy stages, step-by-step.

When you use your phone, or a computer, you will be used to pressing on an icon or on a menu, but using graphics is extremely restricting!  If there is no image or menu for what you want to do, then you can’t do it.

Instead of depending upon images and menus, if you type computer code into a terminal, you can type any of the thousands of commands your computer understands, so using typed commands into a terminal is extremely liberating!  Suddenly, your computer can do far more than you ever imagined.

What we are going to be doing is typing some code into a terminal, and then send that code to the computer to instruct the computer in how to perform the Solid POD Server creation.

SOLID POD SERVER CREATION – BACKGROUND

In September 2018 Sir Tim Berners-Lee wrote that one of the purposes of Solid is to give

“every one of us complete control over data, personal or not, in a revolutionary way.”

Currently, if you had one-thousand Facebook friends, the Facebook server would be holding information about all one-thousand of them.  Facebook would have access to their addresses, their photographs, their employment details, their ages, etc.   All that information would be on a single server owned by a single commercial company.

The Solid way envisages the information about those same one-thousand people being stored on many servers, with each person having a personal Solid POD. The experience for each user would be similar, but instead of all the information being stored in a single server, the information itself would be under the complete control of each individual. The information would be held in one-thousand individual POD’s, with each of the one thousand people having control of their own POD and their own information.

One of the main features of this model is that your POD can be hosted on any server. The more Solid POD server companies there are, the more that the information is scattered around the web and not under the control of a single large company.

Taking this even further,

  • Any company can host their own Solid POD server.
  • Any individual can host their own Solid POD server.

So how easy is it for someone to install a Solid POD server at home?

This page provides detailed instructions on how I created my own Solid POD server at home, using a cheap Raspberry Pi

SOLID POD SERVER CREATION –  EXTERNAL SERVER ACCESS

You may be familiar with the fact that every one of your computers or mobile phones has an ip address, and that your router also has an ip address. These ip addresses are used for your local network. If three people on your network connect to the internet via a browser at the same time, these ip addresses are used to ensure that the right website is visible on the right browser.

What is not always known, is that as well as having a network ip address, a router also has a puplic facing ip address. If you are currently using a computer at home you can discover the public ip address of your router by visiting whatismyip.com

SOLID POD SERVER CREATION –  FREE DOMAIN NAME

This guide uses a free domain from dynu.com but there are several similar services.  Create a free account on https://www.dynu.com

Go to https://www.dynu.com/ControlPanel/AddDDNS and select a free website address, for example Yourname.mywire.org

That domain name will automatically be directed to your home IP address

SOLID POD SERVER CREATION –  PORT FORWARDING

You are currently forwarding your URL (e.g. Yourname.mywire.org) to the router in your home.  Now you need to tell your router to forward youor URL to your Raspberry Pi.

All routers are different and you will need to search online for instructions for your own router settings. On my router the process is as follows:

Log into the router using the administrator username and password.
Go to the ‘Settings’ tab, and then to the ‘Port Forwarding’ tab.

On my router there is a drop down ‘Game or Application’ menu, and I select ‘Secure Web Server’. There is also a drop down ‘Device’ menu, and I select my Raspberry Pi. Then click on the ‘Add’ button.

This forwards your URL to the usual secure port of 443.  If you already have a website running on this port, then you will need to change this to the default secure port used by Solid which is 9443

  •  I then changed the advanced settings on my router to enable port forwarding, so that anything coming IN to my router to the public ip address was forwarded to port 8443 (the default port used by the Solid Server) on my raspberry pi.

SOLID POD SERVER CREATION –  DYNAMIC IP CHANGES

The IP address on a home router is not a ‘static IP’. It is a ‘dynamic IP’. What this means in practice is that periodically your IP address will change. When that happens then your Solid POD server will not be available publicly because your domain name will no longer be pointing to your IP address.

The free domain name you have registered from dynu.com also comes with free software that can be installed on your Raspberry Pi.   As soon as your IP address changes this is noticed by the software, and the software immediately communicates with dynu.com to notify it of the new IP address. Your website is then redirected to the new IP address with little to no down-time (seconds).

This free software, and a link to installation guides can be found at https://www.dynu.com/en-US/?Url=%2FResources%2FDownloads

SOLID POD SERVER CREATIONNODE.JS AND NPM

Node.js and NPM are both required in order to install Solid, and they are installed by typing the following code into your terminal (check for latest Node package number at https://deb.nodesource.com).


curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash –
sudo apt-get install -y nodejs build-essential

SOLID POD SERVER CREATIONINSTALLING SOLID

Solid can now be installed using the following code (you may get some ‘depreciated’ warnings during Solid’s development phase, but these can be ignored):


sudo npm install -g solid-server

SOLID POD SERVER CREATIONCERTBOT INSTALLATION

You need to be able to access your site securely in order to install Solid, and for secure access you need a security certificate. The easiest free way of obtaining a certificate is to use Certbot, which can be installed as follows:

First, edit /etc/apt/sources.list using the following code:


sudo nano /etc/apt/sources.list

Scroll to the bottom of the file and type in the following line

deb http://ftp.debian.org/debian stretch-backports main

You save the file by typing ‘ctl O‘, then enter, then ‘ctl Exit
Then type the following code:

apt-get update
apt-get -t stretch-backports install certbot

Once Certbot has been installed, you then need to install the actual certificate and key, and make a note of the location where the certificate and key are installed (Replace ‘YourHostname.com‘ with the name of your free domain name:

certbot certonly –authenticator standalone -d YourHostname.com

In my case the certbot certificate was saved to: /etc/letsencrypt/live/MyHostName.com/fullchain.pem
The certbot key was saved to: /etc/letsencrypt/live/MyHostName.com/privkey.pem

SOLID POD SERVER CREATIONINITIALISING SOLID

I moved into the /var/www/html directory (you need to create the /www/html direcories if you have not already got them) then run the following code:


sudo solid init

There will then be a series of questions to which you need to type in answers, and there will be suggested defaults. The answers I used are as follows:

? Path to the folder you want to serve. Default is /var/www/html/data
? SSL port to run on. Default is 8443
? Solid server uri (with protocol, hostname and port) https://MyHostname.com
? Enable WebID authentication Yes
? Serve Solid on URL path /
? Path to the config directory /var/www/html/config
? Path to the config file /var/www/html/config.json
? Path to the server metadata db directory (for users/apps etc) /var/www/html/.db
? Path to the SSL private key in PEM format /etc/letsencrypt/live/MyHostname.com/privkey.pem
? Path to the SSL certificate key in PEM format /etc/letsencrypt/live/MyHostname.com/fullchain.pem
? Enable multi-user mode No
? Do you want to set up and email service? No

The remaining questions are optional and answers are not required

At the end of the initialisation process a config.json file was created, and because I had moved to the correct location before commencing the initialisation the config.json was created at the correct location.

I then needed to create the folders/directories mentioned above that I did not already have. In my case the required folders/directories were:

/var/www/html/config
/var/www/html/.db
/var/www/html/data

As I was already in the /var/www/html directory, the code was as follows:


sudo mkdir config
sudo mkdir data
sudo mkdir .db

STARTING THE SOLID SERVER

You could start the Solid Server straight away by typing ‘sudo solid start’ into the terminal, but if you did it would stop running as soon as you close the terminal!  You can prevent this by starting the Solid Server with the following nohup (no hang up) command.


sudo nohup solid start –port 8443 &

You should now be able to log into your server, and register on your server for a new account. The new WebID will look something like https://YourWebsite.com/profile/card#me

THE COST OF RUNNING A SOLID POD SERVER
ON A RASPBERRY PI

In January 2019 my Raspberry Pi 3 Model B+ cost £28.39, the official power supply cost me £5.50, and the optional case cost me a further £4.83 making a total of £38.72. Because I live in the UK I had VAT to pay on top and this brought the total to £46.46

The only extra expenditure required to set up the Raspberry Pi as a Solid POD server was the cost of the SD card. An 8GB card is required to run the software, so a 32GB card would give you enough to run the software and have 24Gb left over to store information on your POD (this is 9GB more than a basic Google Drive storage). In my case I decided to add a 64GB card to allow for all eventualities!

The Raspberry Pi was able to run the Solid POD Server continuously without getting hot, was completely silent, and cost far less to run than an ordinary light bulb.

TAKING THINGS FURTHER

As things stand at the moment you have created a Solid POD Server on a Raspberry Pi that runs as ‘sudo’.  For security reasons it is better to create a separate user for the Server, and instructions for doing this can be found on the Inrupt website but are repeated here for completeness

First, you need to create a non sudo user with the name ‘solid’ to use the server


sudo adduser –system –ingroup www-data –no-create-home solid

The above code created user ‘solid’ with group www-data

Then create a file /lib/systemd/system/solid.service


sudo nano /lib/systemd/system/solid.service

containing the following details:


[Unit]
Description=solid – Social Linked Data
Documentation=https://solid.inrupt.com/docs/
After=network.target

[Service]
Type=simple
User=solid
WorkingDirectory=/var/www/your.host.example.org
ExecStart=/usr/bin/solid start -v
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then add a symlink using the following code


ln -s /lib/systemd/system/solid.service /etc/systemd/system/multi-user.target.wants/

Then made sure you are in the correct directory and make the new user ‘solid’ the owner of the solid directories


cd /var/www/html
sudo chown solid:www-data config/ data/ .db/

Then check that the user ‘solid’ is able to read the config.json file


ls -l config.json

Finally, restart the server with the following code


nohup systemctl start solid.service

https://example.com should display the ‘Welcome to the Solid Prototype’ Register/login page

Having got to grips with Solid POD Server Creation on a Raspberry Pi, your next question (if you do not already know) will be to wonder what you can do with it now you’ve created it.   The following page is a simple explanation of what you can do with a Solid POD Server.