安装Anaconda
- 下载:Anaconda2-5.1.0-Linux-x86_64.sh :
https://www.anaconda.com/download/#linux 在shell中执行下面命令
~$ > bash Anaconda2-5.1.0-Linux-x86_64.sh -b PREFIX=/home/ubuntu/anaconda2
配置环境变量
~$ > 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"
使配置生效
~$ > source /etc/environment
虚拟机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