安裝:html
https://jupyter.readthedocs.io/en/latest/install.html#installnode
配置python
原材料:服務器
Ubuntu 16.04 LTS 64bitpost
已經配置好 IPython 和 Jupyter (安裝步驟能夠參照:http://www.cnblogs.com/McKean/p/6194977.html)url
cd ~/.jupyter 切換到.jupyter目錄spa
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pemcode
成功的話,會在.jupyter目錄下面產生 mykey.key 和 mycert.pem 兩個文件orm
注意:這個OpenSSL是可選的,即便不適用OpenSSL也能夠配置 jupyter使得局域網裏面能夠訪問的。server
能夠在IPython裏面輸入一下命令並按照提示輸入密碼,便可產生你須要密碼對應的sha1值。
1
2
3
4
5
6
7
8
9
10
11
|
In [
1
]:
from
notebook.auth
import
passwd
In [
2
]: passwd()
c:\python27\lib\getpass.py:
92
: GetPassWarning: Can
not
control echo on the termi
nal.
return
fallback_getpass(prompt, stream)
Warning: Password
input
may be echoed.
Enter password:
12345678
Warning: Password
input
may be echoed.
Verify password:
12345678
Out[
2
]:
'sha1:c88810a822cf:2a10d54101bf6b326351c15f0c7b9fede372ef23'
|
使用 ls 命令查看.jupyter 目錄下面有沒有 jupyter_notebook_config.py 文件
若是沒有,則使用 jupyter notebook --generate-config 命令產生一個
默認jupyter_notebook_config.py的配置都使用#註釋掉,下面須要開啓所須要的命令。
這裏password 一項要使用前面產生的sha1值## The full path to an SSL/TLS certificate file.c.NotebookApp.certfile = u'/home/peter/.jupyter/mycert.pem
1
2
3
4
5
6
7
8
9
10
|
## The IP address the notebook server will listen on.
c.NotebookApp.ip
=
'192.168.242.139'
# The string should be of the form type:salt:hashed-password.
c.NotebookApp.password
=
u
'sha1:96d749b4e109:17c2968d3bc899fcd41b87eb0853a42ceb48c521'
## The port the notebook server will listen on.
c.NotebookApp.port
=
8888
c.NotebookApp.open_browser
=
False
|
配置Jupyter notebook的默認目錄
1
|
c.NotebookApp.notebook_dir
=
u
'/home/peter/Git/MatlabMisc/Jupyter'
|
在~/.jupyter目錄下,輸入下面命令便可
sudo jupyter notebook --certfile=mycert.pem --keyfile mykey.key
而後在其餘機器上,輸入 https://192.168.242.139:8888 (這裏的ip是根據你本身的環境和在jupyter_notebook_config.py 文件配置的ip)
再輸入密碼便可
轉載:http://www.cnblogs.com/McKean/p/6391380.html