- open a terminal
- docker ps -a
- docker pull jupyterhub/jupyterhub
- docker run -it -p 8000:8000 –name jhubcontainer [jupyterhub/juoyterhub or the ID here] bash
- apt update
- apt-get update
- apt-get install -y git
- apt-get install npm nodejs python3 python3-pip git nano
- python3 -m pip install jupyterhub notebook jupyterlab
- npm install -g configurable-http-proxy
- apt-get update
- apt-get install zsh -y
- chsh -s /usr/bin/zsh
- echo $SHELL
- sh -c “$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”
- cd /home
- git clone https://github.com/jupyterhub/nativeauthenticator.git
- pip install jupyterhub-nativeauthenticator
# Copy image file to the server
scp [file Address] [user]@[host address]:/home/express/
#load the image
docker load < busybox.tar.gz
# execute the container
docker exec -it <mycontainer> bash
# save the container to an image
docker commit [container] [name]
# remove an image from docker
docker rmi [image]
Steps
For this tutorial you need Docker installed in Windows .
Install Docker From a standard Ubuntu Repository
sudo apt install docker.io
# Start docker and enable it to start after the system reboot:
sudo systemctl enable --now docker
# Optionally give any user administrative privileges to docker:
sudo usermod -aG docker SOMEUSERNAME
# You will need to log out and log in to apply the changes.
#open a Windows cmd and type
powershell
#run a jupyterhub container
docker run -it -p 8000:8000 --name jhubcontainer jupyterhub/jupyterhub bash
# update the repositories
apt update
# install python3 and related packages
apt-get install npm nodejs python3 python3-pip git nano
# install jupyterhub and jupyterlab
python3 -m pip install jupyterhub notebook jupyterlab
# install nodejs packages
npm install -g configurable-http-proxy
# install native authenticator package
cd /home
git clone https://github.com/jupyterhub/nativeauthenticator.git
cd nativeauthenticator
pip3 install -e .
#modify jupyterconfig
mkdir /etc/jupyterhub
nfig.py
cd /etc/jupyterhub
jupyterhub --generate-config -f jupyterhub_co
#edit the jupyterhun config file
nano jupyterhub_co
nfig.py
import pwd, subprocess
c.JupyterHub.authenticator_class = 'nativeauthenticator.NativeAuthenticator'
c.Authenticator.admin_users = {'admin'}
def pre_spawn_hook(spawner):
username = spawner.user.name
try:
pwd.getpwnam(username)
except KeyError:
subprocess.check_call(['useradd', '-ms', '/bin/bash', username])
c.Spawner.pre_spawn_hook = pre_spawn_hook
c.Spawner.default_url = '/lab'
docker commit -m "all installed" jupyterhub_container jupyterhub_plus
docker exec -it jupyterhub_container zsh
docker build -t jup:1 .
# run jupyterhub
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
# configure admin and users
http://localhost:8000/hub/signup
Sign up your admin as “admin” and password.
Login as admin and go the authorize window:
http://localhost:8000/hub/authorize
#get the local ip from the computer by typing this in a new cmd:
ipconfig
# for new users
Go to the server local ip address and jupyterhub port
192.168.XXX.XXX:8000/signup
New users that sign up will be displayed to be authorized.
not related but beautiful:
source venv/bin/activate
Also to create it:
virtualenv venv