JupyterLab安装并启用外网访问,域名绑定

JupyterLab安装并启用外网访问,域名绑定

思路也不复杂,采用了PIP安装,使用LNMP方式做前端访问,Nginx做反向代理、并绑定域名,与Jupyter指向同一目录,服务器上防火墙无需多开额外端口。安装好以后,添加服务及开机启动。参考了以下文章:

https://www.ishelo.com/amp/331

/usr/lib/systemd/system/jupyterlab.service
文件内容:
[UNIT]

#服务描述
Description=Helo JupyterLab Service
Documentation=https://www.ishelo.com
After=network.target
Wants=network.target    

[Service]

ExecStart=/usr/local/bin/jupyter lab
Restart=on-abnormal
RestartSec=5s
KillMode=mixed
#创建私有的内存临时空间
PrivateTmp=True
        
[Install]
             
#多用户
WantedBy=multi-user.target

保存后运行:

# 更新配置
systemctl daemon-reload
# 启动服务
systemctl start jupyterlab
# 设置开机启动
systemctl enable jupyterlab


以下为管理命令:

# 启动服务
systemctl start jupyterlab

# 停止服务
systemctl stop jupyterlab

# 重启服务
systemctl restart jupyterlab

# 查看状态
systemctl status jupyterlab