遵循这些说明(Running a notebook server和Remote access to IPython Notebooks 我按照以下步骤进行:
在远程服务器上:
1)设置NotebookApp.password()
In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
2)创建个人资料
user@remote_host$ ipython profile create
3)修改~/.ipython/profile_default/ipython_notebook_config.py
# Password to use for web authentication
c = get_config()
c.NotebookApp.password =
u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
4)在端口8889上启动笔记本
user@remote_host$ ipython notebook --no-browser --port=8889
然后笔记本开始了
[I 16:08:10.012 NotebookApp]使用CDN的MathJax:https://cdn.mathjax.org/mathjax/latest/MathJax.js
[W 16:08:10.131 NotebookApp]终端不可用(错误是没有模块命名' terminado')
[I 16:08:10.132 NotebookApp]从本地目录提供笔记本:/ cluster / home / user
[I 16:08:10.132 NotebookApp] 0个活动内核
[I 16:08:10.132 NotebookApp] IPython Notebook运行于:http://localhost:8889/
[I 16:08:10.132 NotebookApp]使用Control-C停止此服务器并关闭所有内核(两次以跳过确认)。
在我的本地计算机上
5)SSH隧道
user@local$ ssh -N -f -L localhost:8888:127.0.0.1:8889 username@remote_host
在远程主机(/etc/hosts
)上找到
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
6)最后,我尝试在浏览器上打开localhost:8888
,然后我得到:
频道2:开启失败:连接失败:拒绝连接
频道2:开启失败:连接失败:拒绝连接
频道2:开启失败:连接失败:拒绝连接
频道2:开启失败:连接失败:拒绝连接
频道2:开启失败:连接失败:拒绝连接
所有这些步骤都在一台服务器上运行,但在另一台服务器上运行失败。
我尝试与管理员联系并说出以下内容:
我假设你使用两个独立的SSH连接:一个来自 你运行ipython和你用来进行端口转发的那个。 无法保证这两个连接会让您登陆 相同的登录节点。在两个连接打开的情况下 不同的主机,您将体验到您所遇到的确切故障 遇到。因此,您应该在中设置端口转发 用于运行ipython的连接。
如何在用于运行ipython的连接中设置端口转发?
我尝试使用我的IP地址,但它没有工作
$ ssh -N -f -L local_ip_address:8888:127.0.0.1:8889 user@remote_host
答案 0 :(得分:5)
最后,这就是问题的解决方法:
# Login to the server from your local workstation and in the same connection do the port forwarding.
user@local$ ssh -L 8888:localhost:8889 username@remote_host
user@remote_host$ ipython notebook --no-browser --port=8889
答案 1 :(得分:0)