#author("2025-12-05T07:39:59+00:00","default:iseki","iseki")
#author("2025-12-05T07:54:04+00:00","default:iseki","iseki")
* JupyterHub for Ubuntu Server 24
- [[Ubuntu Server]]

** Install & Setup
*** Install
**** Python 3.11 (pip)
 add-apt-repository ppa:deadsnakes/ppa
 apt -y install python3.11 python3.11-distutils
 apt -y install python3-pip
 python3.11 -m pip install --ignore-installed --break-system-packages pip   # これで /usr/local/bin/pip 使用可
 pip --version
 apt -y remove python3-jsonschema

**** configurable-http-proxy 4.x.x
 apt -y install npm
 npm install -g configurable-http-proxy@4

**** Jupyter
 export PIP_ROOT_USER_ACTION=ignore
 pip install jupyterhub==4.*                         # JupyterHub5 は未サポート
 pip install jupyterhub-ltiauthenticator
 pip install dockerspawner
 pip install notebook
 pip install jupyterlab
 pip install jupyterlab-language-pack-ja-JP
 pip install jupyter_server_fileid
 pip install jupyter_server_ydoc
 pip install jnotice               # メッセージ表示用
**** リポジトリ
- 鍵
 curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
     | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 chmod a+r /etc/apt/keyrings/docker.gpg

- リポジトリリスト
 echo \
    "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
    https://download.docker.com/linux/ubuntu noble stable" \
    | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

**** docker 
 apt update
 apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 systemctl start docker     # or systemctl enable --now docker
 ps ax|grep docker
**** docker image
 docker pull ghcr.io/jupyter-fumihax/jupyterhub-ltictr.singleuser

**** LTIContainerSpawner
 apt -y install build-essential autoconf automake autotools-dev libtool pkg-config  # for compile
 git clone https://github.com/jupyter-fumihax/lticontainerspawner
 cd lticontainerspawner/
 make jp

*** 最小セットアップ
**** openssl (TEST用のサーバ証明書)
 openssl req -x509 -newkey rsa:2048 -sha256 -days 365 -nodes \
    -keyout /etc/ssl/private/jupyterhub.key \
    -out /etc/ssl/certs/jupyterhub.crt \
    -subj "/CN=localhost"



**** Configure of LTIContainerSpawner
 vi /usr/local/etc/ltictr/jupyterhub_lticontainer_config.py    # change my_ip_addr and ssl_server_cert, ssl_private_key




*** 接続テスト
 vipw              # ユーザのグループを 100 辺りにしておく.

 systemctl start jupyterhub
 ps ax|grep jupyterhub

- https://IPアドレス/        # システムに存在するユーザでログイン
*** Options of Install
*** Install of Options
**** Culler
 pip install wheel 
 pip install pycurl
 wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/a6b7e303df03865d6420f6bccdf627b39f1d0dc1/examples/cull-idle/cull_idle_servers.py
 cp cull_idle_servers.py /usr/local/bin
 chmod a+rx /usr/local/bin/cull_idle_servers.py
 vi /usr/local/etc/ltictr/jupyterhub_lticontainer_config.py      # Culler を有効にする
** Trouble Shooting

*** JupyterHub のログ
- journalctl -u jupyterhub
*** JupyterHub のバージョンを変更
 jupyterhub upgrade-db
または
 \rm /var/lib/jupyterhub/*

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 ページ一覧 検索 最終更新   ヘルプ   最終更新のRSS