设置 jupyter notebook 可远程访问
2017-08-09 17:08
483 查看
首先是要 安装 Anaconda 。
默认情况下,安装好 Anaconda 后打开 jupyter notebook, 访问本地
设置 jupyter notebook 可远程访问的官方指南在这里,在远端服务器上执行以下操作:
如果是 root 用户执行上面的命令,会发生一个问题:
提示信息很明显,root 用户执行时需要加上
执行成功后,会出现下面的信息:
以上设置完以后就可以在服务器上启动 jupyter notebook,
需要注意的是不能在隐藏目录 (以 . 开头的目录)下启动 jupyter notebook, 否则无法正常访问文件。
参考:
[1] http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#notebook-server-security
默认情况下,安装好 Anaconda 后打开 jupyter notebook, 访问本地
localhost:8888即可。但是如果要访问另一台机器,比如远端服务器上的 notebook, 即默认是不支持
172.104.105.119:8888这样的访问,需要额外配置。
设置 jupyter notebook 可远程访问的官方指南在这里,在远端服务器上执行以下操作:
1. 生成一个 notebook 配置文件
默认情况下,配置文件~/.jupyter/jupyter_notebook_config.py并不存在,需要自行创建。使用下列命令生成配置文件:
jupyter notebook --generate-config
如果是 root 用户执行上面的命令,会发生一个问题:
Running as root it not recommended. Use --allow-root to bypass.
提示信息很明显,root 用户执行时需要加上
--allow-root选项。
jupyter notebook --generate-config --allow-config
执行成功后,会出现下面的信息:
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
2. 生成密码
自动生成
从 jupyter notebook 5.0 版本开始,提供了一个命令来设置密码:jupyter notebook password,生成的密码存储在
jupyter_notebook_config.json。
$ jupyter notebook password Enter password: **** Verify password: **** [NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_config.json
手动生成
除了使用提供的命令,也可以通过手动安装,我是使用的手动安装,因为jupyter notebook password出来一堆内容,没耐心看。打开 ipython 执行下面内容:
In [1]: from notebook.auth import passwd In [2]: passwd() Enter password: Verify password: Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed这一串就是要在
jupyter_notebook_config.py添加的密码。
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'
3. 修改配置文件
在jupyter_notebook_config.py中找到下面的行,取消注释并修改。
c.NotebookApp.ip='*' c.NotebookApp.password = u'sha:ce...刚才复制的那个密文' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口
以上设置完以后就可以在服务器上启动 jupyter notebook,
jupyter notebook, root 用户使用
jupyter notebook --allow-root。打开
IP:指定的端口, 输入密码就可以访问了。
需要注意的是不能在隐藏目录 (以 . 开头的目录)下启动 jupyter notebook, 否则无法正常访问文件。
参考:
[1] http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#notebook-server-security
相关文章推荐
- 设置 jupyter notebook 可远程访问&&设置jupyer 权限问题&
- jupyter notebook设置远程访问权限
- 跟我一起学python第二讲 开发工具Jupyter Notebook安装和远程访问设置
- 设置 jupyter notebook 可远程访问
- 远程访问jupyter notebook
- 远程访问jupyter notebook
- 如何远程访问jupyter notebook
- jupyter notebook远程访问
- 深度学习环境搭建:linux下 Ubuntu16.04+cuda8.0+cudnn+anaconda+tensorflow并配置远程访问jupyter notebook
- 远程访问jupyter notebook--->出现网络无法连接的问题
- 远程访问jupyter notebook
- Mac远程访问Ubuntu Jupyter notebook
- 本地远程访问Ubuntu16.04.3服务器上的Jupyter notebook
- 远程访问jupyter notebook
- Linux下远程访问Jupyter Notebook 配置
- 实验教程1:如何在阿里云服务器ECS上安装anaconda,配置远程访问的jupyter notebook
- 远程访问jupyter notebook
- 远程访问jupyter notebook
- 远程访问jupyter notebook
- 远程访问jupyter notebook