jupyter服務器遠程環境配置

  1. 下載jupyter。在服務器上下載並安裝anaconda(anaconda自帶jupyter)。
  2. 執行命令upyter notebook --generate-config,會在/home/zhangxuchang/.jupyter文件夾下生成配置文件jupyter_notebook_config.py
  3. 執行命令openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout notebook_cert.key -out notebook_cert.pem,會生成簽名證書、notebook_cert.key 以及notebook_cert.pem(應該是在當前目錄下,如果找不到你find一下)。
  4. 執行命令python -c "import IPython;print(IPython.lib.passwd())"生成一個sha1碼。
  5. 在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
    
  6. 執行命令jupyter notebook
  7. 在瀏覽器輸入https://x.x.x.x:8889訪問即可。注意,必須是https開頭。

參考:http://baijiahao.baidu.com/s?id=1596866816908926760&wfr=spider&for=pc

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章