在CentOS7服務器端啟動jupyter notebook服務,在windows端使用jupyter notebook,服務器充當后台計算雲端
在服務器端啟動jupyter notebook服務,在windows端使用jupyter notebook,服務器充當后台計算雲端
在服務器端啟動jupyter notebook
(base) [jiangshan@localhost keras]$ jupyter notebook
[I 08:37:13.550 NotebookApp] Writing notebook server cookie secret to /run/user/1001/jupyter/notebook_cookie_secret
[I 08:37:15.081 NotebookApp] JupyterLab extension loaded from /home/jiangshan/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 08:37:15.081 NotebookApp] JupyterLab application directory is /home/jiangshan/anaconda3/share/jupyter/lab
[I 08:37:15.084 NotebookApp] Serving notebooks from local directory: /home/jiangshan/workspace/keras
[I 08:37:15.084 NotebookApp] The Jupyter Notebook is running at:
[I 08:37:15.084 NotebookApp] http://localhost:8888/?token=21f607d8864b2ce268922e53b14af8e7c11714c8290547d2
[I 08:37:15.085 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 08:37:15.103 NotebookApp] No web browser found: could not locate runnable browser.
[C 08:37:15.104 NotebookApp]
To access the notebook, open this file in a browser:
file:///run/user/1001/jupyter/nbserver-18076-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=21f607d8864b2ce268922e53b14af8e7c11714c8290547d2
在windows端,將服務器的8888端口重定向到windows端(做了映射綁定):
ssh -L 8888:127.0.0.1:8888 jiangshan@192.168.1.191
【第一個8888為windows端端口,第二個8888服務器端端口】
在windows端,瀏覽器輸入:
http://localhost:8888/tree【或http://127.0.0.1:8888】
登錄

OMG 不知道密碼????
回到CentOS7服務器端
(base) [jiangshan@localhost keras]$ jupyter notebook --generate-config
Writing default config to: /home/jiangshan/.jupyter/jupyter_notebook_config.py
vim /home/jiangshan/.jupyter/jupyter_notebook_config.py
命令模式下輸入查找NotebookApp.allow_password_change: /NotebookApp.allow_password_change,並按Enetr
NotebookApp.allow_password_change=False 【去掉注釋】
(base) [jiangshan@localhost keras]$ vim /home/jiangshan/.jupyter/jupyter_notebook_config.py
(base) [jiangshan@localhost keras]$ jupyter notebook password
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /home/jiangshan/.jupyter/jupyter_notebook_config.json
內容:
{
"NotebookApp": {
"password": "sha1:b78610c54d93:7099a2a12725948960a00760b"
}
}
(base) [jiangshan@localhost keras]$ vim /home/jiangshan/.jupyter/jupyter_notebook_config.py
命令模式下輸入查找c.NotebookApp.password: /c.NotebookApp.password,並按Enetr
# The string should be of the form type:salt:hashed-password.
c.NotebookApp.password = 'sha1:b78610c54d93:7099a2a127c55d18960a00760b'【加上sha1:....,去掉注釋】
(base) [jiangshan@localhost keras]$ jupyter notebook
[I 09:09:20.691 NotebookApp] JupyterLab extension loaded from /home/jiangshan/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 09:09:20.691 NotebookApp] JupyterLab application directory is /home/jiangshan/anaconda3/share/jupyter/lab
[I 09:09:20.693 NotebookApp] Serving notebooks from local directory: /home/jiangshan/workspace/keras
[I 09:09:20.693 NotebookApp] The Jupyter Notebook is running at:
[I 09:09:20.693 NotebookApp] http://localhost:8888/
[I 09:09:20.694 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 09:09:20.699 NotebookApp] No web browser found: could not locate runnable browser.
在Windows端,dos或anaconda自帶的Prompt終端
輸入:ssh -L 8888:127.0.0.1:8888 jiangshan@192.168.1.191
(base) F:\workspace\GitHub_web_download\keras\examples>ssh -L 8888:127.0.0.1:8888 jiangshan@192.168.1.191
jiangshan@192.168.1.191's password:
Last login: Thu Mar 14 08:39:28 2019 from 192.168.1.72
打開瀏覽器,輸入
http://127.0.0.1:8888【或http://localhost:8888/tree】


