## 安装npm
echo y | sudo apt install nodejs npm
## 需要验证一下在安装了npm之后是否还需要安装libffi-dev
## 需要安装libffi-dev, 否则报错:fatal error: ffi.h: No such file or directory
echo y | sudo apt install libffi-dev
pip3 install jupyterlab
## 配置远程登录, 使用非root用户, 我这里一时疏忽,用了root账号,所以在启动时需要加上--allow-root
jupyter lab --generate-config
## 配置jupyter server 的密码
jupyter server password
# 接着输入密码
# 然后会在/home/ckycst/.jupyter/ 目录下生成jupyter_server_config.json文件
## 配置jupyter 的IP地址
cd /root/.jupyter
echo "c.ServerApp.ip = '0.0.0.0'" >> jupyter_lab_config.py
echo "c.ServerApp.port = 8888" >> jupyter_lab_config.py
echo "c.ServerApp.allow_origin = '*'" >> jupyter_lab_config.py
echo "c.ServerApp.allow_remote_access = True" >> jupyter_lab_config.py
echo "c.ExtensionApp.open_browser = False" >> jupyter_lab_config.py
echo "c.ServerApp.token = ''" >> jupyter_lab_config.py
echo "c.ServerApp.password = u'jupyter_server_config.json中的password'" # 这里的password是jupyter_server_config.json中的password
# or, use command jupyter lab -- ip=192.168.31.225 来设置server的地址
## startup the jupyterlab
nohup jupyter lab --allow-root >> /var/log/jupyter.log 2>&1 &
jupyter --version >> /var/log/jupyter.log