Jupyter notebook 远程访问服务器

安装Anaconda

  1. 下载:Anaconda2-5.1.0-Linux-x86_64.sh :
    https://www.anaconda.com/download/#linux
  2. 在shell中执行下面命令

    ~$ > bash  Anaconda2-5.1.0-Linux-x86_64.sh -b PREFIX=/home/ubuntu/anaconda2
  3. 配置环境变量

    ~$ > sudo nano /etc/environment
    输入:
    PATH=":/home/ubuntu/anaconda2/bin"
    ANACONDA_HOME=/home/ubuntu/anaconda2
    PYSPARK_DRIVER_PYTHON=/home/ubuntu/anaconda2/bin/ipython
    PYSPARK_DRIVER_PYTHON_OPTS="notebook"
  4. 使配置生效

    ~$ > source /etc/environment
  5. 虚拟机master下启动ipython notebook

 本地浏览器不能访问http://localhost:8888 
 原因: ipython notebook 本身绑定ip为: 127.0.0.1,所以本地无法访问.

6.jupyter notebook 远程访问官网文档
http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#notebook-server-security

解决方法

如果~/.jupyter/jupyter_notebook_config.py文件不存在,则手动生成
s100 $> jupyter notebook - -generate-config
自动生成密码
    s100 $> ipython
    In [1]: from notebook.auth import passwd
    In [2]: passwd()
    Enter password: 
    Verify password: 
    Out[2]: 'sha1:43c97abf9fdc:8542eea61c6cfe0389a6dcb7e6b4ec50e120c1f5'
修改jupyter_notebook_config.py, 取消注释
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha:ce...上面生成的密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8889 #可自行指定一个端口, 访问时使用该端口
重新启动ipython notebook,并在本地浏览器访问

启动jupyter notebook:
~ $> pyspark
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值