在VPS上安装Jupyter Notebook
1.安装Anaconda3
https://repo.continuum.io/archive/
wget https://repo.continuum.io/archive/复制对应系统的链接
bash 对应系统的文件名
2. 生成Notebook密码
ipython >>> from notebook.auth import passwd >>> passwd()
记录输出的 sha1字段
3.生成jupyter配置文件
jupyter notebook --generate-config #jupyter文件存放目录 mkdir /root/jupyter
4.编辑config文件
文件在用户目录的 .jupyter/jupyter_notebook_config.py
# 允许通过任意绑定服务器的ip访问 c.NotebookApp.ip = '0.0.0.0' #c.NotebookApp.ip = '127.0.0.1' #本地访问 # 用于访问的端口 () c.NotebookApp.port = 8888 # 不自动打开浏览器 c.NotebookApp.open_browser = False # 设置登录密码 c.NotebookApp.password = 'sha1:71f8e51647b****************' # 设置默认目录 #需要 c.NotebookApp.notebook_dir = u'/root/jupyter/' # 设置URL c.NotebookApp.base_url = '/'
5. 开启jupyter
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
6.公网访问
小流量,上面的配置已经可以在 ip:8888访问了
最好还是用Nginx反带一下吧
配置文件:
server { listen 8080; #自定义端口号 #server_name neolee.com; #如有 access_log /var/log/nginx/jupyter.access.log; error_log /var/log/nginx/jupyter.error.log; charset utf-8; location / { proxy_hide_header X-Powered-By; proxy_redirect off; proxy_pass http://localhost:8888; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; } }
转了LNMP就比较方便了,ssl也可以