갈루아의 반서재

원격지 주피터 노트북 로컬에서 실행하기 Remote Access to Jupyter Notebook via SSH



로컬호스트에서 원격지에서 구동중인 Jupyter Notebook 을 실행해보자.


1. 원격지에서 아래와 같이 Ipython notebook 을 실행한다. 원격지에서 브라우저를 띄울 필요는 없으므로 --no-browser 플래그를 추가한다. 해당 포트 방화벽 정책 적용 여부도 확인해본다.

1
2
3
4
5
6
7
8
(tensorflow)root@localhost:~# ipython notebook --no-browser --port=8889
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
[I 21:50:25.953 NotebookApp] Serving notebooks from local directory: /root
[I 21:50:25.953 NotebookApp] 0 active kernels
[I 21:50:25.953 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 21:50:25.954 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 02:07:34.229 NotebookApp] 302 GET / (::11.03ms
cs


2. 로컬 머신 Bash Shell 에 아래와 같이 입력한다.

1
2
3
4
5
6
alicia@vikander MINGW64 ~
$ ssh ---L localhost:8888:localhost:8889 remote_user@remote_host
remote_user@remote_host's password:
alicia@vikander MINGW64 ~
$
cs


-N

 원격지 명령 실행되지 않음

 -f

 SSH 백그라운드 실행

 -L

 포트 포워딩 구성을 보여준다 (여기서 remote port 8889 에서 local port 8888 로 포워딩되고 있다)


3. 브라우저에 localhost:8888 입력하면 아래와 같이 로컬 브라우저에서 원격지 노트북이 구동됨을 확인할 수 있다.



※ 여기서는 Git Bash를 사용했다.