前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >远程访问服务器 jupyter notebook 的设置方法

远程访问服务器 jupyter notebook 的设置方法

作者头像
邓飞
发布2019-06-13 19:45:42
7K0
发布2019-06-13 19:45:42
举报

本篇教程,介绍如何设置服务器的Jupyter,并远程登陆, 就像rstudio-server一样的。

1, 安装jupyter notebook

这里推荐安装Anaconda

wget https://repo.anaconda.com/archive/Anaconda3-2018.12-Linux-x86_64.sh
bash Anaconda3-2018.12-Linux-x86_64.sh

安装好之后运行jupyter notebook, 不报错, 说明安装成功

jupyter notebook
[W 14:39:00.106 NotebookApp] .....

2, 配置文件

局域网登陆Jupyter notebook, 要有密码, 类似RStudio-server

2.1, 生成配置文件

jupyter notebook --generate-config

如果之前有配置文件, 你可以选择覆盖, 从新进行设置: 选择y

Overwrite /home/dengfei/.jupyter/jupyter_notebook_config.py with default config? [y/N]y
Writing default config to: /home/dengfei/.jupyter/jupyter_notebook_config.py

2.2, 编辑~/.jupyter/jupyter_notebook_config.py文件

vim ~/.jupyter/jupyter_notebook_config.py

设置如下:

  • 允许远程访问
  • 不使用本地浏览器打开
  • 允许所有IP访问
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.ip='*'

把上面三行追加到配置文件的末尾:

3, 生成密码

打开ipython

 from notebook.auth import passwd  
 passwd()

输入notebook的密码即可.

4, 运行notebook命令, 查看是否可以登录

(base) [dengfei@localhost ~]$ jupyter notebook
[W 14:54:28.145 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 14:54:28.147 NotebookApp] The port 8888 is already in use, trying another port.
[I 14:54:28.189 NotebookApp] JupyterLab extension loaded from /home/dengfei/anaconda3/lib/python3.6/site-packages/jupyterlab
[I 14:54:28.190 NotebookApp] JupyterLab application directory is /home/dengfei/anaconda3/share/jupyter/lab
[I 14:54:28.191 NotebookApp] Serving notebooks from local directory: /home/dengfei
[I 14:54:28.192 NotebookApp] The Jupyter Notebook is running at:
[I 14:54:28.192 NotebookApp] http://(localhost.localdomain or 127.0.0.1):8889/
[I 14:54:28.192 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

上面显示, 8888这个端口已经占用, 这里使用8889端口. 因为本地服务器的IP为: 192.168.3.44, 所以我使用

192.168.3.44:8889

进行访问

5, 输入上步设置的密码, 进行登录.

在哪一个路径打开的jupyter notebook, notebook中就显示当前路径

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-03-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 育种数据分析之放飞自我 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1, 安装jupyter notebook
  • 2, 配置文件
  • 3, 生成密码
  • 4, 运行notebook命令, 查看是否可以登录
  • 5, 输入上步设置的密码, 进行登录.
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档