原创
云服务器部署 jupyter notebook
### 1 安装python
```html
yum install python
```
### 2 升级pip
pip 工具为python自带包管理工具
```shell
pip install --upgrade pip
```
### 3 安装jupyter
```shell
pip install jupyter
```
### 4 jupyter 配置
```shell
jupyter notebook --generate-config -allow-root
```
##### 4.1 进入 ipython
```shell
ipython
```
##### 4.2 引包
```shell
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
```
##### 4.3 得到秘钥
```shell
Out [2]: 'sha1:5d8d5d6ea2a5:04a*************************3c24b7280b67'
```
##### 4.4 退出
```shell
In [3]: exit()
```
### 5 修改配置文件
```shell
vim /root/.jupyter/jupyter_notebook_config.py
```
```shell
# 对外提供访问的ip,设置为0.0.0.0,则为所有地址可访问
c.NotebookApp.ip = '0.0.0.0'
# 对外提供访问的端口
c.NotebookApp.port = 8888
# 启动不打开浏览器
c.NotebookApp.open_browser = False
# 上面生成的秘钥
c.NotebookApp.password = 'sha1:5d8d5d6ea2a5:04a*************************3c24b7280b67'
# 设置jupyter启动后默认文件夹
c.NotebookApp.notebook_dir = '/root/jupyter'
# 允许root用户执行
c.NotebookApp.allow_root = True
```
### 6 后台启动服务
用&让命令后台运行, 并把标准输出写入jupyter.log中nohup表示no hang up, 就是不挂起, 这个命令执行后即使终端退出, Jupyter也不会停止运行.
```shell
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
```
### 7 关闭后台运行的jupyter
```shell
ps -ef | grep xxxx
kill -9 PID
```
jupyter
云服务器