ipython: 通过网络浏览器远程访问笔记本服务器

ipython: access notebook server remotely via a web browser

我想通过网络浏览器远程访问笔记本服务器,following 显示了我是如何设置我的笔记本服务器的:

1.generate 配置文件

$ jupyter-notebook --generate-config
$ cd ~/.jupyter

2.Use 以下命令创建 SSL 证书(Linux 和 Windows)。

req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

3.edit 配置文件的配置文件,即 jupyter_notebook_config.py 密码已生成..

c = get_config()

# You must give the path to the certificate file.
c.NotebookApp.certfile = u'/home/azureuser/.jupyter/mycert.pem'

# Create your own password as indicated above
c.NotebookApp.password = u'sha1:b86e933199ad:a02e9592e5 etc... '

# Network and browser details. We use a fixed port (9999) so it matches
# our Azure setup, where we've allowed :wqtraffic on that port
c.NotebookApp.ip = '*'
c.NotebookApp.port = 9999
c.NotebookApp.open_browser = False

4.start $ jupyter-notebook 服务器

您现在应该可以在地址 https://[PUBLIC-IP-ADDRESS]:9999 访问您的 Jupyter Notebook。

启动笔记本:

$  ~ jupyter-notebook 
[I 16:46:58.627 NotebookApp] Serving notebooks from local directory: /home/user
[I 16:46:58.627 NotebookApp] 0 active kernels 
[I 16:46:58.627 NotebookApp] The Jupyter Notebook is running at: https://SERVER_IP:9999/
[I 16:46:58.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

但是,当我在https://MY_SERVER_IP:9999打开我的浏览器(在我家,笔记本服务器在我实验室)时,页面无法打开。和 Chrome-浏览器 returns:

ERR_ADDRESS_UNREACHABLE

我该怎么办?

对应的9999端口在服务器上被block,而服务器是Centos7并且iptables没有开放端口,所以使用firewall-cmd激活端口:

$ firewall-cmd --zone=public --add-port=9999/tcp --permanent
$ firewall-cmd --reload

如果firewallD不是运行,直接启动服务即可。

您遵循的那些说明有些过时了:

  1. Anaconda 是版本 4。
  2. Jupyter 预装了新的 Anaconda
  3. Jupyter 默认使用端口“8888”
  4. 您应该提及如何获得您为配置记录的修改。我最终进入 nano 来做这件事。
  5. 您不能将 "sudo" 与 conda 一起使用。

如果你想在 VPS 上从头开始安装 Ipython notebook,并通过 ssh 访问它,我在这里写了一个更新的教程:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-jupyter-notebook-to-run-ipython-on-ubuntu-16-04

在服务器上使用命令行安装和 运行 Ipython Notebook 后,您可以使用 Putty(在 windows 上)或 ssh -L 类 Unix 系统上的命令(即 Mac 和 Linux)