您的位置:首页 > 其它

Mac远程访问Ubuntu Jupyter notebook

2017-12-16 10:00 459 查看
背景:本人的server是Ubuntu,现在MAC端启动该server的Jupyter notebook。

(1-6都是Mac terminal上的操作)

1. 用terminal对Ubuntu server进行SSH连线。 指令 ssh username@xxx.xxx.xxx.xxx (username -你的用户名 xxx.xxx.xxx.xxx -server的ip)

2. 确认server端已经安装好了Jupyter notebook。否则,安装指令 pip install jupyter

3.输入以下指令生成配置文件

$jupyter notebook --generate-config


4.输入指令获取密钥

python
>>from notebook.auth import passwd
>>passwd()
>>"""
>>这里会要求用户输入密码并确认,生成的hash值要填写到上面
>>"""


5. 输入以下指令打开配置文件进行修改

vim ~/.jupyter/jupyter_notebook_config.py
修改的地方:

c.NotebookApp.ip='*',即不限制ip访问
c.NotebookApp.password = u'hash_value',hash value就填上面生成的那串密钥 (e.g u‘SHXXX’)
c.NotebookApp.open_browser = False ,原本是True改成False。




6. server上启动Jupyter notebook

jupyter notebook


7. 在Mac的browser输入http://xxx.xxx.xxx.xxx:8888 (xxx是server的IP),就会进入登入画面,此处的密码就是步骤4设置的密码。

reference:

[1]http://blog.leanote.com/post/jevonswang/%E8%BF%9C%E7%A8%8B%E8%AE%BF%E9%97%AEjupyter-notebook

[2]https://xmfbit.github.io/2017/02/26/jupyternotebook-remote-useage/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: