首页 > 其他 > 详细

JupyterLab远程访问配置方法(CentOS7)

时间:2019-08-21 12:40:05      阅读:565      评论:0      收藏:0      [点我收藏+]

下载 Anaconda3安装包,并执行安装命令:

bash Anaconda3-2019.07-Linux-x86_64.sh

确定安装并初始化:

Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes

安装完Anaconda3后用conda命令安装jupyterlab:

conda install jupyterlab

需要用ipython命令生成秘钥,启动ipython:

ipython

执行命令生成秘钥:

In [1]: from notebook.auth import passwd
In [2]: passwd() 
Enter password: 
Verify password: 
Out[2]: sha1:f704b702aea2:01e2bd991f9c7208ba177b46f4d10b6907810927

产生jupyterlab配置文件:

jupyter lab --generate-config

修改配置文件:

vi /root/.jupyter/jupyter_notebook_config.py

更改内容如下:

# 将ip设置为*,意味允许任何IP访问
c.NotebookApp.ip = *
# 这里的密码就是上边我们生成的那一串
c.NotebookApp.password = sha1:f704b702aea2:01e2bd991f9c7208ba177b46f4d10b6907810927 
# 服务器上并没有浏览器可以供Jupyter打开
c.NotebookApp.open_browser
= False
# 监听端口设置为8888或其他自己喜欢的端口
c.NotebookApp.port
= 8888
# 允许远程访问
c.NotebookApp.allow_remote_access
= True

接下来输入jupyter lab启动jupyter服务即可:

jupyter lab --allow-root

返回如下信息:

[W 10:47:12.159 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 10:47:12.166 LabApp] JupyterLab extension loaded from /root/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 10:47:12.166 LabApp] JupyterLab application directory is /root/anaconda3/share/jupyter/lab
[I 10:47:12.169 LabApp] Serving notebooks from local directory: /root
[I 10:47:12.169 LabApp] The Jupyter Notebook is running at:
[I 10:47:12.169 LabApp] http://dn07:8888/
[I 10:47:12.169 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 10:47:47.415 LabApp] 302 GET /?token=fe7d07705f34f7e0d81d0c169f06f5cb11039cd13092b4d6 (10.200.74.155) 0.53ms
[I 10:47:47.422 LabApp] 302 GET /lab?token=fe7d07705f34f7e0d81d0c169f06f5cb11039cd13092b4d6 (10.200.74.155) 0.55ms
[E 10:47:47.463 LabApp] Could not open static file ‘‘
[W 10:47:47.511 LabApp] 404 GET /static/components/react/react-dom.production.min.js (10.200.74.155) 7.64ms referer=http://10.200.101.112:8888/login?next=%2Flab%3Ftoken%3Dfe7d07705f34f7e0d81d0c169f06f5cb11039cd13092b4d6
[W 10:47:47.564 LabApp] 404 GET /static/components/react/react-dom.production.min.js (10.200.74.155) 1.58ms referer=http://10.200.101.112:8888/login?next=%2Flab%3Ftoken%3Dfe7d07705f34f7e0d81d0c169f06f5cb11039cd13092b4d6

打开页面查看:

技术分享图片

直接点击“Log in”登录主界面:

技术分享图片

解释:Ipython把输入的密码转换成sha,并用于认证JupyterLab,本文在Ipython输入密码和确认密码时直接回车,相当于不设密码,因此登录JupyterLab时可以不输入密码直接点击登录。

 

参考:

https://blog.csdn.net/qixizhuang/article/details/82793442

https://www.cnblogs.com/xiao-apple36/p/9052102.html

JupyterLab远程访问配置方法(CentOS7)

原文:https://www.cnblogs.com/ratels/p/11387740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!