jupyterlab 설치

OS : ubuntu 18

설치

  • apt update
    sudo apt update

 

  • jupyterlab pip 설치
    sudo apt install -y python3-pip jupyter-core

 

  • jupyterlab 설치
    pip3 install jupyterlab

 

  • user profile 재 적용
    source ~/.profile

 

  • config 파일 생성
    jupyter notebook --generate-config
    출력 : Writing default config to: /home/ubuntu/.jupyter/jupyter_notebook_config.py

 

  • jupyter_notebook_config.py 파일 최하단에 아래 내용 추가
    vi /home/ubuntu/.jupyter/jupyter_notebook_config.py

      c = get_config()
      c.NotebookApp.ip = '[내부 IP]'
      예시:
          c = get_config()
          c.NotebookApp.ip = '172.31.24.168'

    ip 확인 방법

      ubuntu@ip-172-31-24-168:~$ ifconfig
      eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
              inet 172.31.24.168  netmask 255.255.240.0  broadcast 172.31.31.255
              inet6 fe80::8e2:ff:fe7e:171c  prefixlen 64  scopeid 0x20<link>
              ether 0a:e2:00:7e:17:1c  txqueuelen 1000  (Ethernet)
              RX packets 99783  bytes 141887383 (141.8 MB)
              RX errors 0  dropped 0  overruns 0  frame 0
              TX packets 13314  bytes 1613233 (1.6 MB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
      lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
              inet 127.0.0.1  netmask 255.0.0.0
              inet6 ::1  prefixlen 128  scopeid 0x10<host>
              loop  txqueuelen 1000  (Local Loopback)
              RX packets 378  bytes 36028 (36.0 KB)
              RX errors 0  dropped 0  overruns 0  frame 0
              TX packets 378  bytes 36028 (36.0 KB)
              TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

실행

  • jupyter lab 실행
    jupyter lab --allow-root

      ubuntu@ip-172-31-24-168:~$ jupyter lab --allow-root
      [I 11:32:14.547 LabApp] Writing notebook server cookie secret to /home/ubuntu/.local/share/jupyter/runtime/notebook_cookie_secret
      [W 11:32:14.843 LabApp] JupyterLab server extension not enabled, manually loading...
      [I 11:32:14.847 LabApp] JupyterLab extension loaded from /home/ubuntu/.local/lib/python3.6/site-packages/jupyterlab
      [I 11:32:14.847 LabApp] JupyterLab application directory is /home/ubuntu/.local/share/jupyter/lab
      [I 11:32:14.849 LabApp] Serving notebooks from local directory: /home/ubuntu
      [I 11:32:14.849 LabApp] The Jupyter Notebook is running at:
      [I 11:32:14.850 LabApp] http://localhost:8888/?token=7b8f33048569544c7aa237ee485698eb21d7c7e7182b9c12
      [I 11:32:14.850 LabApp]  or http://127.0.0.1:8888/?token=7b8f33048569544c7aa237ee485698eb21d7c7e7182b9c12
      [I 11:32:14.850 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
      [W 11:32:14.854 LabApp] No web browser found: could not locate runnable browser.
      [C 11:32:14.854 LabApp]
          To access the notebook, open this file in a browser:
              file:///home/ubuntu/.local/share/jupyter/runtime/nbserver-7550-open.html
          Or copy and paste one of these URLs:
              http://localhost:8888/?token=7b8f33048569544c7aa237ee485698eb21d7c7e7182b9c12
           or http://127.0.0.1:8888/?token=7b8f33048569544c7aa237ee485698eb21d7c7e7182b9c12
  • 위 출력 내용에 IP를 외부 IP를 입력한다.
    http://[외부 IP]:8888/?token=7b8f33048569544c7aa237ee485698eb21d7c7e7182b9c12

 

  • 빙화벽 AWS 라면 보안그룹에 8888 포트를 연다.

 

  • 백그라운드 실행 및 소유권 포기 (ssh 접속을 끊어도 서비스를 유지하는 방법)
    단축 키 입력 : Ctrl +Z
    cmd 입력 : bg
    cmd 입력 : disown -h

+ Recent posts