1.安裝jupyter notebook
pip install jupyter notebook
2.配置jupyter notebook
2.1 自動創建config文件
jupyter notebook --generate-config --allow-root
2.2 生成連接密碼
# 打開ipython
from notebook.auth import passwd
passwd()
會生成一個 sha1碼,複製下來。
2.2 打開剛纔自動創建的config文件
gedit /home/your_usr_name/.jupyter/jupyter_notebook_config.py
修改如下部分
# for default work space
c.NotebookApp.notebook_dir = 'your_work_path'
# for remote connection
c.NotebookApp.ip = 'your_server_ip'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:the sha1' # 注意:這裏的字符串包含"sha1:"
c.NotebookApp.port = 8888 #the port your jupyter server listen on
注意:配置前面的“#”刪除掉才生效
2.3 本地Xshell配置
在“屬性”-“連接”-“SSH”-“隧道”中添加“偵聽端口信息”。
偵聽端口 :8888
目標端口:8888
3.遠程啓動
3.1 xshell中啓動jupyter
jupyter notebook
3.2 本地瀏覽器中打開 "your_server_ip:8888"
輸入密碼,密碼就是2.2中生成sha1時輸入的密碼。
完事兒