JupyterPi: Difference between revisions
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 47: | Line 47: | ||
First jupyterlab needs to be installed: | First jupyterlab needs to be installed: | ||
$ pip3 install jupyterlab | |||
You can use the make_user_accounts.py script with the following scripts: | You can use the <code>make_user_accounts.py</code> script with the following scripts: | ||
* | * <code>--passwords</code>: words.txt -- a txt file with ingredient words on each line to generate passwords with | ||
* | * <code>--from_file</code>: users.txt -- a txt file with a username on each line | ||
* | * <code>--servername</code>: sandbox -- a string | ||
The script generates: | The script generates: | ||
* | * <code>users.csv</code>: a list of all the users, their personal ports, their passwords | ||
* | * <code>users.md</code>: a bulletpoint list with a link to the <code>/__LAB__/</code> link for each user | ||
* | * <code>users.nginx.conf</code>: snippets of nginx configuration that can be added to the main nginx config file | ||
Then the service file template is copied: | 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. | This service file is a template for all the jupyter lab services that are running, which is one for each user. | ||
Line 69: | Line 69: | ||
Now try to start one jupyterlab instance with: | Now try to start one jupyterlab instance with: | ||
$ sudo systemctl start jupyter@murtaugh | |||
==Reset your jupyter password== | |||
First run this to find your jupyterlab "port", which you will need to give it to the reset script in a second: | |||
$ cat /home/USERNAME/.jupyter/jupyter_notebook_config.py | |||
Then move to the folder where the reset script is: | |||
$ cd /srv/jupyterpi/ | |||
And run the reset script: | |||
$ sudo python3 reset_jupyter_password.py |
Latest revision as of 11:31, 6 March 2024
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
https://shop.pimoroni.com/products/pibow-coupe-4?variant=29210100170835
And for the fan
https://shop.pimoroni.com/products/fan-shim
TINC
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)
nginx
on XVM: We add nginx configurations on the XVM, adding a reverse proxy from /sandbol to 10.0.0.13.
on Sandbol: Then we install nginx on the pi as the webserver of the sandbol.
JupyterPi
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:
https://git.xpub.nl/XPUB/jupyterpi
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
: sandbox -- a string
The script generates:
users.csv
: a list of all the users, their personal ports, their passwordsusers.md
: a bulletpoint list with a link to the/__LAB__/
link for each userusers.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
Reset your jupyter password
First run this to find your jupyterlab "port", which you will need to give it to the reset script in a second:
$ cat /home/USERNAME/.jupyter/jupyter_notebook_config.py
Then move to the folder where the reset script is:
$ cd /srv/jupyterpi/
And run the reset script:
$ sudo python3 reset_jupyter_password.py