xiaolei@ubuntu:~$ sudo apt install python
xiaolei@ubuntu:~$ sudo pip install jupyter
#主要.jupyter 是隐藏文件,可以用ls -a 查看
#以下命令生成文件在 /home/xiaolei/.jupyter/jupyter_notebook_config.py
xiaolei@ubuntu:~$ jupyter notebook --generate-config
xiaolei@ubuntu:~$ python
from notebook.auth import passwd
: from notebook.auth import passwd
: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:bcd259ccf...<你自己生成的hash密码>'
#以下命令生成文件在 /home/xiaolei/.jupyter/jupyter_notebook_config.py
xiaolei@ubuntu:~$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem
xiaolei@ubuntu:~$ jupyter notebook --certfile=/home/xiaolei/.jupyter/mycert.pem --keyfile /home/xiaolei/.jupyter/mykey.key
xiaolei@ubuntu:~$ vim /home/xiaolei/.jupyter/jupyter_notebook_config.py
# Set options for certfile, ip, password, and toggle off
# browser auto-opening
c.NotebookApp.certfile = u'/home/xiaolei/.jupyter/mycert.pem'
c.NotebookApp.keyfile = u'/home/xiaolei/.jupyter/mykey.key'
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
c.NotebookApp.password = u'sha1:bcd259ccf...<你自己生成的hash密码>'
c.NotebookApp.open_browser = False
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 9999
xiaolei@ubuntu:~$ jupyter notebook --no-browser
此时输入你设置的密码如123456
如果没有安装Spark,那么到这里就完成配置了,已经可以在windows中开发Linux环境下的程序了!
xiaolei@ubuntu:~$ PYSPARK_DRIVER_PYTHON=jupyter PYSPARK_DRIVER_PYTHON_OPTS='notebook' /opt/spark-2.0.2-bin-hadoop2.7/bin/pyspark