From XPUB & Lens-Based wiki

Installing JupyterPi on a Raspberry Pi

Notes from Monday 20th of September 2021

Downloading the OS on the SD card

Downloaded latest Raspberry Pi OS Lite image which today was: https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-lite.zip

I stick the SD card into my laptop and use the "Disks" program to confirm what it's name is: /dev/mmcblk0

(nb this pipeline uses pv to show the progress -- you need to apt install it first -- or just remove it as it's not strictly necessary)

$ unzip -p 2021-05-07-raspios-buster-armhf-lite.zip | pv | sudo dd of=/dev/mmcblk0 bs=4M
1.75GiB 0:00:52 [34.2MiB/s] [                                              <=> ]
0+28608 records in
0+28608 records out
1874853888 bytes (1.9 GB, 1.7 GiB) copied, 89.6663 s, 20.9 MB/s

Follow the instructions for the case


And for the fan



We're following this page Tinc to connect the pi to the XPUB virtual private network (VPN).

And we follow this page to add a node to the hub: XPUB_HUB_New_Nodes

(the Tinc page needs cleaning)


on XVM: We add nginx configurations on the XVM, adding a reverse proxy from /sandbol to

on Sandbol: Then we install nginx on the pi as the webserver of the sandbol.


Then, to set up the pi as a shared server with multiple Jupyter Lab instances for each user, you can use the code that we have been writing here:


First jupyterlab needs to be installed:

`pip3 install jupyterlab`

You can use the make_user_accounts.py script with the following scripts:

  • `--passwords`: words.txt -- a txt file with ingredient words on each line to generate passwords with
  • `--from_file`: users.txt -- a txt file with a username on each line
  • `--servername`: sandbol -- a string

The script generates:

  • `users.csv`: a list of all the users, their personal ports, their passwords
  • `users.md`: a bulletpoint list with a link to the `/__LAB__/` link for each user
  • `users.nginx.conf`: snippets of nginx configuration that can be added to the main nginx config file

Then the service file template is copied:

`sudo cp templates/jupyterlab@.service /etc/systemd/system`

This service file is a template for all the jupyter lab services that are running, which is one for each user.

Now try to start one jupyterlab instance with:

`sudo systemctl start jupyter@murtaugh`