- 下載jupyter。在服務器上下載並安裝anaconda(anaconda自帶jupyter)。
- 執行命令
upyter notebook --generate-config
,會在/home/zhangxuchang/.jupyter
文件夾下生成配置文件jupyter_notebook_config.py
。 - 執行命令
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout notebook_cert.key -out notebook_cert.pem
,會生成簽名證書、notebook_cert.key 以及notebook_cert.pem(應該是在當前目錄下,如果找不到你find一下)。 - 執行命令
python -c "import IPython;print(IPython.lib.passwd())"
生成一個sha1碼。 - 在jupyter_notebook_config.py最後面追加以下內容:
c = get_config() c.NotebookApp.certfile = u'/root/.jupyter/notebook_cert.pem' # 步驟3生成的notebook_cert.pem文件 c.NotebookApp.keyfile = u'/root/.jupyter/notebook_cert.key' # 步驟3生成的notebook_cert.key文件 c.NotebookApp.password = u'sha1:e4c7da7f727d:3e891cc7b0126f30c1677b9d2d4ea7d42a1e7342' # 步驟4生成的sha1碼 c.NotebookApp.ip = 'x.x.x.x' # 你自己服務器的ip c.NotebookApp.port = 8888 c.NotebookApp.open_browser = False
- 執行命令
jupyter notebook
。 - 在瀏覽器輸入https://x.x.x.x:8889訪問即可。注意,必須是https開頭。
參考:http://baijiahao.baidu.com/s?id=1596866816908926760&wfr=spider&for=pc