๐Ÿ‘ป OS & Tools/Ubuntu

์„œ๋ฒ„์— jupyter notebook ์›๊ฒฉ ์—ฐ๊ฒฐ

๋ณต๋งŒ 2020. 1. 2. 21:33

์ฐธ๊ณ 

1) https://hiseon.me/python/jupyter-notebook-install/

2) https://blog.djjproject.com/m/487

3) https://eungbean.github.io/2019/03/22/jupyter-ssh/

4) https://www.blopig.com/blog/2018/03/running-jupyter-notebook-on-a-remote-server-via-ssh/

1)~3) ๋”ฐ๋ผํ•˜๋‹ค๊ฐ€ ๋ธŒ๋ผ์šฐ์ €์— localhost:9000์œผ๋กœ ์—ด๋ฉด ์•ˆ์—ด๋ ค์„œ 4)๋ฅผ ์ฐธ๊ณ .

 

 

1. (local)ssh ์ด์šฉํ•˜์—ฌ ์—ฐ๊ฒฐ

ssh [id]@[server]

 

2. (server)๊ฐ€์ƒํ™˜๊ฒฝ ์ƒ์„ฑ

conda create -n [name]

 

3. (server)๊ฐ€์ƒํ™˜๊ฒฝ ์ง„์ž…

source activate [name]

 

4. (server)conda ์ด์šฉํ•˜์—ฌ jupyter notebook ์„ค์น˜

conda install jupyter
# pip ์€ root ๊ถŒํ•œ ํ•„์š”

 

5. (server)์„ค์ • ํŒŒ์ผ ์ƒ์„ฑ

jupyter notebook --generate-config
# default location: ~/.jupyter/jupyter_notebook_config.py

 

์„ค์ • ํŒŒ์ผ ์—ด์–ด์„œ ๋‹ค์Œ์˜ ๋‚ด์šฉ์œผ๋กœ ์„ค์ • ํŒŒ์ผ ์ˆ˜์ •

c.NotebookApp.allow_remote_access=True

 

6. (server)๋น„๋ฐ€๋ฒˆํ˜ธ ์„ค์ •

jupyter notebook password

 

7. (server)์„œ๋ฒ„์—์„œ no browser ์˜ต์…˜์œผ๋กœ ์‹คํ–‰, ํฌํŠธ๋ฒˆํ˜ธ ์ง€์ •

jupyter notebook --port=9000 --no-browser &

 

8. (local)์„œ๋ฒ„ 9000๋ฒˆ ํฌํŠธ์™€ local์˜ 8888๋ฒˆ ํฌํŠธ ์—ฐ๊ฒฐ

ssh -N -f -L 8888:localhost:9000 [id]@[server] # local terminal์—์„œ ์‹คํ–‰

 

9. browser์—์„œ localhost 8888๋ฒˆ ํฌํŠธ๋กœ jupyter notebook ์ ‘์† (localhost:8888)

 

* ์ดํ›„ ์ ‘์† ์‹œ 8. ์˜ ๋ช…๋ น์–ด ๋‹ค์‹œ ์ž…๋ ฅํ•˜์ง€ ์•Š๊ณ , ์„œ๋ฒ„์—์„œ 7. ์˜ ๋ช…๋ น์–ด๋กœ jupyter notebook ์‹คํ–‰ํ•˜๋ฉด local browser์—์„œ 8888๋ฒˆ ํฌํŠธ๋กœ ์ ‘์† ๊ฐ€๋Šฅ.

 

* ์ข…๋ฃŒ ์‹œ browser์—์„œ quit ํ•ด์ค˜์•ผ ์ข…๋ฃŒ๋จ. ์„œ๋ฒ„์—์„œ๋งŒ shut downํ•˜๋ฉด ์ข…๋ฃŒ๋˜์ง€ ์•Š์Œ.

 

 

๋ฐ˜์‘ํ˜•