jupyter_远程安装&问题

本文介绍如何在Ubuntu 16.04 LTS上配置Jupyter Notebook作为服务器,包括生成密钥、设置密码、配置文件调整及启动方法。

安装:

https://jupyter.readthedocs.io/en/latest/install.html#install

配置

Ubuntu 16.04 LTS 配置 Jupyter notebook 为服务器

 

原材料:

Ubuntu 16.04 LTS 64bit

已经配置好 IPython 和 Jupyter (安装步骤可以参照:http://www.cnblogs.com/McKean/p/6194977.html)

一、使用OpenSSL产生 *.key 和 *.pem 密钥

cd ~/.jupyter 切换到.jupyter目录

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

成功的话,会在.jupyter目录下面产生 mykey.key 和 mycert.pem 两个文件

注意:这个OpenSSL是可选的,即使不适用OpenSSL也可以配置 jupyter使得局域网里面可以访问的。

二、设置密钥的sha1码

可以在IPython里面输入一下命令并按照提示输入密码,即可产生你需要密码对应的sha1值。

1
2
3
4
5
6
7
8
9
10
11
In [ 1 ]:  from  notebook.auth  import  passwd
 
In [ 2 ]: passwd()
c:\python27\lib\getpass.py: 92 : GetPassWarning: Can  not  control echo on the termi
nal.
   return  fallback_getpass(prompt, stream)
Warning: Password  input  may be echoed.
Enter password:  12345678
Warning: Password  input  may be echoed.
Verify password:  12345678
Out[ 2 ]:  'sha1:c88810a822cf:2a10d54101bf6b326351c15f0c7b9fede372ef23'

  

三、产生并配置 jupyter_notebook_config.py 文件

使用 ls 命令查看.jupyter 目录下面有没有 jupyter_notebook_config.py 文件

如果没有,则使用 jupyter notebook --generate-config 命令产生一个

默认jupyter_notebook_config.py的配置都使用#注释掉,下面需要开启所需要的命令。

这里password 一项要使用前面产生的sha1值## The full path to an SSL/TLS certificate file.c.NotebookApp.certfile = u'/home/peter/.jupyter/mycert.pem

1
2
3
4
5
6
7
8
9
10
## The IP address the notebook server will listen on.
c.NotebookApp.ip  =  '192.168.242.139'
  
#  The string should be of the form type:salt:hashed-password.
c.NotebookApp.password  =  u 'sha1:96d749b4e109:17c2968d3bc899fcd41b87eb0853a42ceb48c521'
  
## The port the notebook server will listen on.
c.NotebookApp.port  =  8888
 
c.NotebookApp.open_browser  =  False

  

配置Jupyter notebook的默认目录

1
c.NotebookApp.notebook_dir  =  u '/home/peter/Git/MatlabMisc/Jupyter'

  

四、启动Jupyter notebook

在~/.jupyter目录下,输入下面命令即可
sudo jupyter notebook --certfile=mycert.pem --keyfile mykey.key

然后在其他机器上,输入 https://192.168.242.139:8888 (这里的ip是根据你自己的环境和在jupyter_notebook_config.py 文件配置的ip)

再输入密码即可

 

转载:http://www.cnblogs.com/McKean/p/6391380.html

 
 
 
 

转载于:https://www.cnblogs.com/cphmvp/p/7281532.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值