JupyterLab

JupyterLab is running at jupyter.nodeholder.com. This post describes how to set up JupyterLab on a private Linux server. It assumes you are using pyenv, should work for conda, too. For multi-user, see JuypterHub.

Install JupyterLab

First install pyenv. Then, in an 'activated' pyenv python shell under user devops:

(ds-dev) devops@host > pip install jupyterlab

Configure Jupyter

Edit /home/devops/.jupyter/jupyter_notebook_config.py:

c.ServerApp.port = 8888
c.ServerApp.ip = '127.0.0.1'
c.ServerApp.local_hostnames = ['localhost','jupyter.nodeholder.com']
c.ServerApp.open_browser = False
(ds-dev) devops@host > vi ~/.jupyter/jupyter_notebook_config.py

Generate password:
(ds-dev) devops@host > jupyter notebook password

Generates hashed password in:
/home/devops/.jupyter/jupyter_notebook_config.json

Configure NGINX

This must be done as root unless devops user is in the sudoer file.

Edit /etc/nginx/sites-available/nodeholder.com:

server {
  server_name jupyter.nodeholder.com;

location / {
  proxy_buffering off;
  proxy_pass http://127.0.0.1:8888;
  proxy_http_version 1.1;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_read_timeout 86400;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP $remote_addr;

  # websocket                                                   
  proxy_set_header X-Scheme $scheme;                            
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $connection_upgrade;
  
  # Use certbot or Acme to get SSLs
}

Restart web daemon via Systemctl:
root@host > systemctl restart nginx

Start JupyterLab

(ds-dev) devops@host > cd dir/with/notebooks;
(ds-dev) devops@host > jupyter lab

Connect

  • https://jupyter.nodeholder.com
  • enter password

References

💡
JupyterLab's  interface allows users to configure and arrange workflows in data science, scientific computing, computational journalism, and machine learning. A modular design invites extensions to expand and enrich functionality. - From jupyter.org.

Written by:

Mike Ricos

Mike Ricos

distributed systems
Building biological data networks.