我在我的centos6.5服务器上启动了一个Jupyter Notebook服务器.而jupyter正在运行
[I 17:40:59.649 NotebookApp] Serving notebooks from local directory: /root
[I 17:40:59.649 NotebookApp] 0 active kernels
[I 17:40:59.649 NotebookApp] The Jupyter Notebook is running at:https://[all ip addresses on your system]:8045/
[I 17:40:59.649 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Run Code Online (Sandbox Code Playgroud)
当我想在同一局域网中远程访问Jupyter时,比如打开http://192.168.1.111:8045/,我根本无法打开Jupyter页面.顺便说一句,我可以成功访问远程centos服务器.
可能的原因是什么?
Jam*_*023 89
您是否配置了jupyter_notebook_config.py文件以允许外部连接?
默认情况下,Jupyter Notebook仅接受来自localhost的连接(例如,来自运行它的同一台计算机).通过将NotebookApp.allow_origin选项从默认的''修改为'*',您可以在外部访问Jupyter.
c.NotebookApp.allow_origin = '*' #allow all origins
您还需要更改笔记本将侦听的IP:
c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
小智 47
我设法通过ip使用下面显示的命令访问我的本地服务器:
jupyter notebook --ip xx.xx.xx.xx --port 8888
Run Code Online (Sandbox Code Playgroud)
替换xx.xx.xx.xx你的jupyter服务器的本地ip.
Kou*_*aul 19
James023已经给出了正确答案。只是格式化
如果尚未配置jupyter_notebook_config.py文件
步骤1:在控制台中输入以下内容来生成文件
jupyter notebook --generate-config
Run Code Online (Sandbox Code Playgroud)
步骤2:编辑值
gedit /home/koushik/.jupyter/jupyter_notebook_config.py
Run Code Online (Sandbox Code Playgroud)
(在任何地方添加以下两行,因为无论如何都会注释默认值)
c.NotebookApp.allow_origin = '*' #允许所有起源
c.NotebookApp.ip = '0.0.0.0' #监听所有IP
第三步:一旦您关闭了gedit,以防您的端口被阻塞
sudo ufw allow 8888 #启用您的tcp:8888端口,这是您的默认jupyter端口
第四步:设置密码
jupyter notebook password #它将提示输入密码
步骤5:启动Jupyter
jupyter notebook
Run Code Online (Sandbox Code Playgroud)
并像http://xxx.xxx.xxx.xxx:8888/login一样连接?
Vik*_*pta 11
在RedHat 7中,我们需要在运行Jupiter命令之前允许特定的端口。说港口是8080。
iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
这样我们就可以正常运行了。例如,使用:
jupyter notebook --ip 0.0.0.0 --no-browser --port=8080 --allow-root
Run Code Online (Sandbox Code Playgroud)
或任何你喜欢的。
Hu *_*ixi 10
从你的命令行,我们可以看到你的jupyter服务器运行正常。 你无法访问远程jupyter服务器的原因是你的远程centos6.5服务器的防火墙规则阻止了来自本地浏览器的传入请求,即阻止你的tcp: 8045端口。
sudo ufw allow 80 # enable http server
sudo ufw allow 443 # enable https server
sudo ufw allow 8045 # enable your tcp:8045 port
然后再次尝试访问您的 jupyter。
也许您还需要取消注释并编辑jupyter_notebook_config.py文件中的那个位置:
c.NotebookApp.allow_remote_access = True
Run Code Online (Sandbox Code Playgroud)
甚至关闭你的VPN(如果你有的话)。
或者,您可以只创建一个到服务器的隧道:
ssh -i <your_key> <user@server-instance> -L 8888:127.0.0.1:8888
Run Code Online (Sandbox Code Playgroud)
然后只需127.0.0.1:8888在浏览器中打开即可。
-i <your_key>如果您没有identity_file,您也可以省略。
首先,如果不可用,请先创建一个配置文件
jupyter notebook --generate-config
Run Code Online (Sandbox Code Playgroud)
然后转到该文件并编辑它
cd ~/.jupyter
Run Code Online (Sandbox Code Playgroud)
取消注释三行或全部删除并添加三行
c.NotebookApp.allow_origin = '*' #allow all origins
c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
c.NotebookApp.allow_remote_access = True
Run Code Online (Sandbox Code Playgroud)
尝试连接远程IP。 (如果您使用的是 AWS EC2,则需要将您的 IP 列入白名单,并为您的客户端 PC 或端口 8888 上的所有 IP 地址启用入站连接)
如果还是无法连接,您可以尝试
jupyter notebook --ip 0.0.0.0 --port 8888
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56615 次 |
| 最近记录: |