junxnone / xwiki

https://junxnone.github.io/xwiki/
0 stars 0 forks source link

Tools Jupyter JupyterHub #66

Open junxnone opened 5 years ago

junxnone commented 5 years ago

Reference

Brief

Install

Install on host

pip3 install jupyterhub
sudo -E npm install -g configurable-http-proxy

Install with Docker

docker run -d -p 8000:8000 --name jupyterhub jupyterhub/jupyterhub jupyterhub

Configure

Host

Create jupyterhub user, Install sudospawner to use PAM

sudo useradd jupyterhub
sudo pip install sudospawner
sudo visudo

To make PAM works, add this lines:

Cmnd_Alias JUPYTER_CMD = /usr/local/bin/sudospawner
%jupyterhub ALL=(jupyterhub) /usr/bin/sudo
jupyterhub ALL=(%jupyterhub) NOPASSWD:JUPYTER_CMD
sudo adduser -G jupyterhub your_username

Generate the config file

jupyterhub --generate-config -f config/jupyterhub_config.py
sudo -u jupyterhub jupyterhub --JupyterHub.spawner_class=sudospawner.SudoSpawner \
-f ./config/jupyterhub_config.py

diff with the origin config file

< #c.JupyterHub.admin_access = False
---
> c.JupyterHub.admin_access = True
48a49
> c.JupyterHub.admin_users = {'name','name','name'}
167c168
< #c.JupyterHub.data_files_path = '/usr/local/share/jupyterhub'
---
> #c.JupyterHub.data_files_path = '/home/name/.local/share/jupyterhub'
318c319
< #c.JupyterHub.ip = ''
---
> c.JupyterHub.ip = 'your_ip'
356c357
< #c.JupyterHub.port = 8000
---
> c.JupyterHub.port = 8000
464c465
< #c.JupyterHub.statsd_prefix = 'jupyterhub'
---
> c.JupyterHub.statsd_prefix = 'jupyterhub'
636a638
> c.Spawner.env_keep.append('LD_LIBRARY_PATH')
820a823
> c.Authenticator.admin_users = {'name','name','name','name'}
933a937
> c.Authenticator.whitelist = {'name','name','name','name','name','name'}

name is your users

junxnone commented 5 years ago

junxnone/Linux#52