安装 Ananconda
wget wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
- 注意,选择安装路径时,如果想要所有用户都能使用,则安装在
usr/local/ananconda3
目录下 - 注意修改
/etc/profile.d
下的conda.sh
,指定环境变量(在登入另外的用户时会提醒) - 更改源。创建
~/.condarc
文件,输入
channels:- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmsys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudbioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudmenpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudpytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloudsimpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- 至此,已经完成 python、conda 及 jupyter-notebook 的安装。
部署远程云服务
jupyter notebook --generate-config
from IPython.lib import passwd
passwd()
Enter password:
Verify password:
vim ~/.jupyter/jupyter_notebook_config.py
- 在末尾增加以下几行配置信息(此配置信息,也可在启动Jupyter时在参数中添加,但我认为那样看起来比较乱)
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.NotebookApp.notebook_dir = '/scott/data'
c.NotebookApp.allow_root = True
nohup jupyter-notebook &
这里使用 nohup
是想在 ssh 窗口关闭后继续运行,同时使用后台运行的方式。
- 最后,在本地输入
ip:8888
即可运行服务器上的 jupyter notebook。