33 lines
893 B
Bash
Executable File
33 lines
893 B
Bash
Executable File
#!/bin/bash
|
|
# 创建用户
|
|
useradd jupyterhub
|
|
echo "jupyterhub:$1" | chpasswd
|
|
|
|
# 检查是否已经安装了必要的工具和库文件
|
|
if ! dpkg -s python3-dev build-essential libffi-dev libssl-dev >/dev/null 2>&1; then
|
|
# 安装必要的工具和库文件
|
|
apt-get update && apt-get install -y \
|
|
python3-dev \
|
|
build-essential \
|
|
libffi-dev \
|
|
libssl-dev
|
|
fi
|
|
|
|
# 检查是否已经安装了JupyterHub
|
|
if ! pip list | grep jupyterhub >/dev/null 2>&1; then
|
|
# 安装JupyterHub
|
|
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyterhub
|
|
fi
|
|
|
|
# 检查是否已经安装了Notebook
|
|
if ! pip list | grep notebook >/dev/null 2>&1; then
|
|
# 安装Notebook
|
|
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple notebook
|
|
fi
|
|
# 配置JupyterHub
|
|
mkdir -p /home/jupyterhub
|
|
chown jupyterhub:jupyterhub /home/jupyterhub -R
|
|
chmod -R 777 /home
|
|
# 启动JupyterHub
|
|
jupyterhub
|