如何使用 systemd 运行 Jupyter Hub(多用户模式)
以下脚本将以单用户模式安装 Jupyter Hub(即只有一个 Linux 用户可以使用 Web 界面登录 Jupyter Hub)。
先决条件
首先安装 Python 和 PIP,然后是 NodeJS,然后是 Jupyter Hub,然后是 configurable-http-proxy:
install_jupyterhub_deps.sh
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs python3-pip
pip install -U jupyterhub
sudo npm i -g configurable-http-proxy安装 Jupyter Hub systemd 服务
使用 sudo 运行以下脚本!
install_jupyterhub_service.sh
#!/bin/bash
# 此脚本安装并启用/启动 JupyterHub systemd 服务
export NAME=JupyterHub
# 创建服务文件
cat >/etc/systemd/system/${NAME}.service <<EOF
[Unit]
Description=${NAME}
[Service]
Type=simple
ExecStart=/usr/bin/env jupyterhub --port=11569
User=root
Group=root
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
EOF
# 启用并启动服务
systemctl enable --now ${NAME}此脚本将安装名为 JupyterHub 的 systemd 服务并在启动时自动启动它。它默认在端口 11569 上运行。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow