遠程連接服務器Jupyter-notebook
1、生成密碼的Hash值
首先登錄服務器,運行ipython
from notebook.auth import passwd
password()
然後連續輸入兩次密碼(就是客戶端遠程連接時輸入的密碼)
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_notebook_config.json
會產生一個Hash值:
sha1 : xxxxxxxxxxx
待用
2、生成配置文件
在 Server 上生成 jupyter notebook 的配置文件
jupyter notebook --generate-config
打開默認的配置文件
vim ~/.jupyter/jupyter_notebook_config.py
然後修改如下:
c.NotebookApp.ip = '*'
c.NotebookApp.password = ' sha1:-----' #這裏就是上面的字符串,這個可以設置也可以不設置
c.NotebookApp.port = 6008 # 這裏的端口可以自己定義,也可以每次啓動時通過控制檯傳參設定
c.NotebookApp.open_browser = False
c.NotebookApp.allow_remote_access = True
c.NotebookApp.allow_root = True
3、訪問方法
配置阿里雲安全組,防火牆開啓6008
端口。
後臺啓動jupyter
nohup jupyter-notebook > nohup.out &
使用nohup 和 & 後臺運行jupyter notebook程序,查看、kill 進程
https://blog.csdn.net/donaldsy/article/details/96350061
客戶端瀏覽器訪問服務器域名或者IP:
就會出現jupyter登錄界面,輸入密碼即可登錄。
pyter登錄界面,輸入密碼即可登錄。