遅まきながらLLMを触ってみようとOllama、Open WebUIをインストールしてみます。
Ollamaはホストローカルに、Open WebUIはDockerコンテナとして構築します。
# NVIDIA DGX Sparkが発表当初$3000で待ってたのですが発売遅れと値上がりで...。
環境は下記、GPUをパススルーした仮想マシンです。
RTX 4070なのでVRAMは12GB。
VRAM容量が多いGPUが欲しいところですが昨今値上がりが激しくて手が出ません。
- vCPU: 8
- Memory: 32GB
- GPU: GeForce RTX 4070 SUPER
- OS: ubuntu 24.04.3
CUDA ToolkitとDriverのインストール
CUDA ToolkitとDriverは公式ドキュメントの通りに下記を実行。
DriverはOpen kernel moduleを入れました。
$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
$ sudo dpkg -i cuda-keyring_1.1-1_all.deb
$ sudo apt-get update
$ sudo apt-get -y install cuda-toolkit-13-1
$
$ sudo apt-get install -y nvidia-open
確認
$ nvidia-smi
Sun Feb 8 20:11:15 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 590.48.01 Driver Version: 590.48.01 CUDA Version: 13.1 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4070 ... On | 00000000:02:05.0 Off | N/A |
| 0% 28C P8 15W / 220W | 1MiB / 12282MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
$
Ollamaのインストール
公式ドキュメントに書いてある通り、下記を実行。
$ curl -fsSL https://ollama.com/install.sh | sh
>>> Installing ollama to /usr/local
>>> Downloading ollama-linux-amd64.tar.zst
######################################################################## 100.0%
>>> Creating ollama user...
>>> Adding ollama user to render group...
>>> Adding ollama user to video group...
>>> Adding current user to ollama group...
>>> Creating ollama systemd service...
>>> Enabling and starting ollama service...
Created symlink /etc/systemd/system/default.target.wants/ollama.service → /etc/systemd/system/ollama.service.
>>> NVIDIA GPU installed.
$
確認とモデル実行
モデルはgemma3:12bを動かしてみます。
$ ollama --version
ollama version is 0.15.5
$ ollama run gemma3:12b
:
>>> こんにちは
こんにちは!何かお手伝いできることはありますか? 😊
>>> /?
Available Commands:
/set Set session variables
/show Show model information
/load Load a session or model
/save Save your current session
/clear Clear session context
/bye Exit
/?, /help Help for a command
/? shortcuts Help for keyboard shortcuts
Use """ to begin a multi-line message.
Use /path/to/file to include .jpg, .png, or .webp images.
>>> /bye
$
Olamaサービスのバインドアドレス変更
サービス設定のデフォルトではlocalhost:11434にバインドされます。
今回、Open WebUIはDockerコンテナを利用します。
コンテナからOllamaに接続できるように下記の設定を/etc/systemd/system/ollama.serviceの[Service]セクションに追加します。
[Service]
Environment="OLLAMA_HOST=0.0.0.0"
設定反映と確認
$ ss -lntp |grep 11434
LISTEN 0 4096 127.0.0.1:11434 0.0.0.0:* users:(("ollama",pid=2505,fd=3))
$
$ sudo systemctl daemon-reload
$ sudo systemctl restart ollama
$ ss -lntp |grep 11434
LISTEN 0 4096 *:11434 *:* users:(("ollama",pid=3505,fd=3))
$
Open WebUIのインストール
Docker Composeで設定します。
公式ドキュメントのサンプルにextra_hostsの定義を追加して、コンテナとホストが通信できるようにします。
$ mkdir ~/OpenWebUI
$ cd ~/OpenWebUI
$ tee docker-compose.yml <<EOF
services:
openwebui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
open-webui:
EOF
$
$ docker compose up -d
ひとまず完成、http://IPアドレス:3000/でOpen WebUIにアクセスできます。
最初のアクセス時に初期設定があり、アカウント登録して利用開始となります。
参考)