apt-get install nodejs npm pip
python3 -m pip install jupyterhub
npm install -g configurable-http-proxy
python3 -m pip install jupyterlab notebook
pip install jupyterlab-language-pack-zh-TW
編輯 /etc/systemd/system/jupyterhub.service
# Template file for JupyterHub systemd service
# Uses simple string.format() for 'templating'
# /etc/systemd/system/jupyterhub.service
# /etc/systemd/system/multi-user.target.wants/jupyterhub.service
[Unit]
#Requires=traefik.service
#After=traefik.service
[Service]
User=root
Restart=always
WorkingDirectory=/opt/jupyterhub
# Protect bits that are normally shared across the system
PrivateTmp=yes
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
#Environment=TLJH_INSTALL_PREFIX=/opt/tljh
# Run upgrade-db before starting, in case Hub version has changed
# This is a no-op when no db exists or no upgrades are needed
ExecStart=/usr/local/bin/jupyterhub
[Install]
# Start service when system boots
WantedBy=multi-user.target
編輯 /opt/jupyterhub/bootstrap.sh
#!/bin/bash
USER=$1
USERHOME=$(eval "echo ~${USER}")
[ "$USER" == "" ]&&exit 0;
[ -d "$USERHOME" ]&&exit 0;
mkdir -p $(dirname $USERHOME);
cp -r /etc/skel $USERHOME;
uid=$(id $USER|tr \( \ |xargs -n 1|grep uid|cut -d= -f2)
gid=$(id $USER|tr \( \ |xargs -n 1|grep gid|cut -d= -f2)
chown -R $uid.$gid $USERHOME && chmod 0700 $USERHOME;
exit 0
沒有留言:
張貼留言