Jupyter Notebook Setup - cchantra/bigdata.github.io GitHub Wiki

preparation for coding Assume we are at user: hadoop

Install pip3 (since by now you should have python3 installed, we only install pip)

sudo apt install python3-pip  

Install jupyter-lab

pip3 install jupyterlab 

Optional

  1. Run ~/.local/bin/jupyter server --generate-config
  2. edit the jupyter_server_config.py by vi /home/hadoop/.jupyter/jupyter_server_config.py

made changes by add into the following command eg. to make passwordless, ….or more if desired

c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8887
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.allow_origin = '*'
c.NotebookApp.allow_remote_access = True

(https://docs.jupyter.org/en/latest/use/jupyter-directories.html)

You can make it as a service by following

(https://www.digitalocean.com/community/tutorials/how-to-set-up-a-jupyterlab-environment-on-ubuntu-18-04)

Eg. my service file sudo vi /etc/systemd/system/Jupyter.service

[Unit]
Description=${NAME}
[Service]
Type=simple
User=hadoop
Group=hadoop
WorkingDirectory=/home/hadoop
ExecStart=/home/hadoop/.local/bin/jupyter-lab --config=/home/hadoop/.jupyter/jupyter_server_config.py
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target

Then enable and start service, allow port for web access

 sudo systemctl enable Jupyter.service
 sudo systemctl  daemon-reload
 sudo systemctl start Jupyter.service
 sudo systemctl status Jupyter.service
 sudo ufw allow 8887/tcp

Now you should be able to acess http://10.3.133.xx:8887

If not, consider using ssh tunnel

ssh -L   8887:10.3.133.xx:8887 [email protected]

then, goto http://localhost:8887