Access remote jupyter-notebook

 

Remarks

이 글은 https://jupyter-notebook.readthedocs.io/en/stable/public_server.html을 참고하여 작성되었습니다.


1. Generate config file

$ jupyter notebook --generate-config  // ~/.jupyter/jupyter_notebook_config.py 생성


2. Prepare a hashed password

$ jupyter notebook

  // In one .ipynb
  In [1]: from noteobook.auth import passwd
  In [2]: passwd()
  Enter password:
  Verify password:
  Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'


3. Adding hashed password to your notebook configuration file

$ vi ~/.jupyter/jupyter_notebook_config.py

  // jupyter_notebook_config
  // c = get_config()  // 안 될 경우 추가
  c.NotebookApp.ip = '*'
  c.NotebookApp.password = u'sha1:~'
  c.NotebookApp.open_browser = False
  c.NotebookApp.allow_origin = '*'
  c.NotebookApp.notebook_dir = '/workspace'  // 시작 directory


4. Unblocking port

$ sudo ufw allow 8888


5. Add kernel

$ source activate [env]
$ pip install ipykernel
$ python -m ipykernel install --user --name [env] --display-name "[display name]"


6. Remove kernel and environment

// Kernel 제거
$ jupyter kernelspec uninstall [display Name]

// Env 제거
$ conda env remove --name [env]