0
Šī revīzija ir iekļauta:
Izpildāmais fails
+13
@@ -0,0 +1,13 @@
|
||||
version: '3'
|
||||
services:
|
||||
jupyterhub:
|
||||
image: jupyterhub/jupyterhub:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
|
||||
- ./init.sh:/init.sh
|
||||
ports:
|
||||
- 8000:8000
|
||||
command: /bin/bash /init.sh 123456
|
||||
|
||||
Izpildāmais fails
+32
@@ -0,0 +1,32 @@
|
||||
#!/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
|
||||
Izpildāmais fails
+25
@@ -0,0 +1,25 @@
|
||||
c = get_config()
|
||||
|
||||
c.Authenticator.allow_all = True
|
||||
c.Authenticator.allow_existing_users = True
|
||||
# 管理员用户列表
|
||||
c.Authenticator.admin_users = {'jupyterhub'}
|
||||
c.DummyAuthenticator.password = "jupyterhub" # 初始密码设置
|
||||
c.JupyterHub.admin_access = True
|
||||
c.LocalAuthenticator.create_system_users=True
|
||||
|
||||
#c.Authenticator.admin_users = {'root'} # 管理员用户
|
||||
#c.DummyAuthenticator.password = "123" # 初始密码设置
|
||||
|
||||
# 使用 PAMAuthenticator 作为身份验证类
|
||||
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
|
||||
# 允许自动创建系统用户
|
||||
c.LocalAuthenticator.create_system_users = True
|
||||
|
||||
|
||||
|
||||
# 设置每个用户的 book类型 和 工作目录(创建.ipynb文件自动保存的地方)
|
||||
c.Spawner.notebook_dir = '~'
|
||||
c.Spawner.default_url = '/lab'
|
||||
c.Spawner.args = ['--allow-root']
|
||||
|
||||
Atsaukties uz šo jaunā problēmā
Block a user