내용

글번호 773
작성자 허진경
작성일 2017-10-25 10:33:41
제목 jupyter notebook 원격으로 접속하기
내용 By default, a notebook server runs locally at 127.0.0.1:8888 and is accessible only from localhost. You may access the notebook server from the browser using http://127.0.0.1:8888. http://jupyter-notebook.readthedocs.io/en/stable/public_server.html 쥬피터 노트북 접속 비밀번호 생성
nova@ubuntu:~$ jupyter notebook password
Enter password: 
Verify password: 
[NotebookPasswordApp] Wrote hashed password to /home/nova/.jupyter/jupyter_notebook_config.json
비밀번호 인코딩
nova@ubuntu:~$ python
Python 2.7.14 (default, Sep 23 2017, 22:06:14) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from notebook.auth import passwd
>>> passwd()
Enter password: 
Verify password: 
'sha1:ac80cfa292ba:b6a7a667ba6f361143ca5c41a8b942dd66c1c9f3'
>>>  Ctrl+z 키로 파이썬 종료
[1]+  Stopped                 python
키 파일 및 키 인증서 생성
nova@ubuntu:~$ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
Generating a 2048 bit RSA private key
...................................................+++
....................................................................................................+++
writing new private key to 'mykey.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:.
Locality Name (eg, city) []:.
Organization Name (eg, company) [Internet Widgits Pty Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (e.g. server FQDN or YOUR name) []:.
Email Address []:.
쥬피터 설정파일 생성 및 수정
nova@Ubuntu:~$ jupyter notebook –generate-config
Writing default config to: /home/nova/.jupyter/jupyter_notebook_config.py
nova@ubuntu:~$ gedit .jupyter/jupyter_notebook_config.py 
# 아래 내용 입력(아무데나 입력해도 됩니다.)
c.NotebookApp.certfile = u'/home/nova/mycert.pem'
c.NotebookApp.keyfile = u'/home/nova/mykey.key'
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
c.NotebookApp.password = u'sha1:ac80cfa292ba:b6a7a667ba6f361143ca5c41a8b942dd66c1c9f3'
c.NotebookApp.open_browser = False

# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 8888
인증서 파일과 키 파일의 위치는 /home/nova 가 아닐 수 있습니다. 키 파일과 인증서 파일을 위치를 절대경로로 입력하세요. 우분투 방화벽에 8888번 포트 허락
nova@ubuntu:~$ sudo ufw allow 8888/tcp
[sudo] password for nova: 
Rules updated
Rules updated (v6)