Ubuntu 24.04 · 26.04 LTS 에 JupyterHub 6.x 를 직접 설치하는 절차다[1]. 시스템 Python 을 더럽히지 않도록 /opt/jupyterhub 아래 venv 에 넣고, 프록시는 npm 으로 전역 설치하며, systemd 서비스로 띄운다. 인증은 OS 계정(PAM), 사용자 서버는 그 계정 권한의 프로세스로 뜬다.
python3-venv, nodejs, npm 설치, 사용자 계정 생성sudo mkdir -p /opt/jupyterhub
sudo python3 -m venv /opt/jupyterhub
sudo /opt/jupyterhub/bin/pip install --upgrade pip wheel
sudo /opt/jupyterhub/bin/pip install jupyterhub==6.0.1 jupyterlab notebook
sudo npm install -g configurable-http-proxy
which configurable-http-proxy
sudo mkdir -p /etc/jupyterhub
cd /etc/jupyterhub
sudo /opt/jupyterhub/bin/jupyterhub --generate-config
/etc/jupyterhub/jupyterhub_config.py 에서 필요한 값만 바꾼다. 6.x 부터는 허용 사용자를 명시하지 않으면 아무도 로그인할 수 없으므로 allow_all 또는 allowed_users 를 반드시 둔다.
c = get_config()
# 접속 주소
c.JupyterHub.bind_url = 'http://0.0.0.0:8000'
c.JupyterHub.hub_ip = '127.0.0.1'
# 인증 — OS 계정. 모든 로컬 계정 허용
c.JupyterHub.authenticator_class = 'pam'
c.Authenticator.allow_all = True
c.Authenticator.admin_users = {'haedong'}
# 사용자 서버 — JupyterLab
c.Spawner.default_url = '/lab'
c.Spawner.notebook_dir = '~'
# 상태 파일 위치
c.JupyterHub.cookie_secret_file = '/etc/jupyterhub/jupyterhub_cookie_secret'
c.JupyterHub.db_url = 'sqlite:////etc/jupyterhub/jupyterhub.sqlite'
c.ConfigurableHTTPProxy.auth_token_file = '/etc/jupyterhub/proxy_token'
특정 계정만 허용하려면 allow_all 대신 c.Authenticator.allowed_users = {'user1', 'user2'} 로 한다.
sudo vi /etc/systemd/system/jupyterhub.service
[Unit]
Description=JupyterHub
After=network-online.target
Wants=network-online.target
[Service]
User=root
Environment="PATH=/opt/jupyterhub/bin:/usr/local/bin:/usr/bin:/bin"
WorkingDirectory=/etc/jupyterhub
ExecStart=/opt/jupyterhub/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now jupyterhub
sudo systemctl status jupyterhub
sudo ufw allow 8000/tcp
브라우저에서 http://<서버 IP>:8000 에 접속해 OS 계정으로 로그인한다. 로그인 후 JupyterLab 이 뜨고 whoami 가 그 계정이면 된다. 로그는 journalctl -u jupyterhub -f 로 본다.
ss -tlnp | grep -E ':8000|:8081'
8000 은 configurable-http-proxy, 8081 은 Hub 가 잡고 있어야 한다.
c.JupyterHub.ssl_cert · ssl_key 로 직접 TLS 를 건다.sudospawner 를 설치하고 c.JupyterHub.spawner_class = 'sudo' 로 바꾼 뒤 sudoers 에 Hub 계정 규칙을 둔다./opt/jupyterhub/bin/pip install 로 넣는다.2021년 테스트 됨. Ubuntu 18.04 에서 시스템 pip 로 설치했다. sudospawner 를 설치하면 의존성으로 jupyterhub · notebook 이 함께 들어온다.
위 버전과 저장소는 오래된 것이라 저장소가 존재하지 않을 수 있다.
sudo apt install nodejs
sudo apt install npm
sudo npm install -g configurable-http-proxy
sudo apt install python3-pip
sudo pip3 install sudospawner
sudo pip3 install jupyterlab
sudo useradd rhea
JupyterHub 6.0.1, 설치 요구사항(Python 3.10+, Node.js 12+) — 2026-09-20 확인. https://jupyterhub.readthedocs.io/en/stable/tutorial/quickstart.html · https://pypi.org/project/jupyterhub/ ↩︎