Solid Pod Server Creation on a Raspberry Pi

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

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.  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 commands, you can type any of the thousands of commands your computer understands.   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 do, is to type 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

To access the server from outside your home you need to make some  adjustments to your home router. I logged into my router as router admin, and made the following changes in the advanced administration section of my router.

  • I allocated a static ip address to the laptop holding my server.  Computers are usually allocated a dynamic ip address which may change every time your computer is turned on, but for a server you require a static ip that does not change. I allocated a static ip address to the Raspbery Pi I was going to be running the Solid POD server on.
  • I then added port forwarding from the router to the Raspberry Pi .  Still in the advance administration section of my router, I added port forwarding to the pi using the port number noted above.

The final part of the jig-saw is to find out your public ip address, which is different to any of the ip addresses of your individual computers or your router.

You may be familiar with the fact that every one of your computers 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

Because you have added port forwarding for this port number, when your router receives an external request for this ip address with this port number, it forwards the request to the computer running your Solid POD server.

PRELIMINARIES

  • I began by checking what my public ip address was and making the changes to my router as described above.
  • I then obtained a free domain name from freenom.com, and changed the ‘A’ record on the freenom server so that the domain pointed to my ip address
  • I then installed Certbot installed and checked that the firewall was open to allow the server to open on https.
  • The certbot certificate saved to: /etc/letsencrypt/live/solid.tk/fullchain.pem
  • the certbot key saved to:/etc/letsencrypt/live/solid.tk/privkey.pem

INSTALLATION

Install Node
(check for latest 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

Install Solid


sudo npm install -g solid-server

Initialise Solid
I moved into the /var/www/html directory and ran the following:


sudo solid init


? Path to the folder you want to serve. Default is /var/www/html/data
? SSL port to run on. Default is 443
? Solid server uri (with protocol, hostname and port) https://example.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/Example.com/privkey.pem
? Path to the SSL certificate key in PEM format /etc/letsencrypt/live/example.com/fullchain.pem
? Enable multi-user mode No
? Do you want to set up and email service? No

Remaining questions were not required

At the end of the initialisation 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 following folders/directories

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


mkdir config
mkdir data
mkdir .db

I then created 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

I then created 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

I then added a symlink using the following code


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

I then made sure I was in the correct directory and made the new user ‘solid’ the owner of the solid directories


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

I then checked that the user ‘solid’ was able to read the config.json file


ls -l config.json

running the above code resulted in a message that although ‘solid’ was not the owner of the file, ‘solid’ was nevertheless able to read its contents

Start Solid Server


systemctl start solid.service

got message that solid had started

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

I clicked on the ‘Register’ button and registered

It then created a WebID for me and published the public homepage

I then logged out of the shell and everything stopped working!

It is possible to keep everything working when you close the terminal by stopping solid and then restart it using the nohup (no hang up) command


sudo nohup solid start  &

That worked, and it continues to work after closing the terminal

Sorted. Having made these changes, provided I left the server running, I was able to access the Solid POD server from elsewhere by using my browser.

Having got to grips with Solid POD Server Creation, 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.