Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| services:open-webui [2025/10/15 11:51] – willy | services:open-webui [2026/03/03 08:56] (current) – willy | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| both can be installed with a container, easily. | both can be installed with a container, easily. | ||
| + | |||
| + | A good NVIDIA GPU is strongly recommended, | ||
| + | |||
| + | Intel GPUs and AMD GPUs are supposed to be supported as well, but i have an NVIDIA GPU so this is what i will be describing in this page. | ||
| + | |||
| ===== Installation ===== | ===== Installation ===== | ||
| Line 14: | Line 19: | ||
| <code bash> | <code bash> | ||
| useradd -d / | useradd -d / | ||
| + | usermod -G video openwebui | ||
| mkdir /data/llm | mkdir /data/llm | ||
| chown openwebui: | chown openwebui: | ||
| Line 24: | Line 30: | ||
| </ | </ | ||
| - | Open WebUI can be installed on bare metal, without containers, using //pip//, but due to strict python requirement (3.11 at the time of writing this), this is not recomended (Gentoo has already Python 3.13). | + | Adding the user to the **video** group is required for accessing GPU, both if using a container or not. |
| - | Let's go with the containers way, using of course | + | Open WebUI can be installed on bare metal, without containers, using //pip//, but due to strict python requirement (3.11 at the time of writing this), this is not recommended (Gentoo has already Python 3.13), and maintenance would be a pity since updates are almost daily. |
| + | |||
| + | Let's go with the containers way, using of course | ||
| From [[https:// | From [[https:// | ||
| Line 46: | Line 54: | ||
| ports: | ports: | ||
| - 3081:11434 | - 3081:11434 | ||
| + | devices: | ||
| + | - nvidia.com/ | ||
| + | annotations: | ||
| + | run.oci.keep_original_groups: | ||
| volumes: | volumes: | ||
| - / | - / | ||
| - / | - / | ||
| container_name: | container_name: | ||
| - | | + | # |
| tty: true | tty: true | ||
| environment: | environment: | ||
| Line 63: | Line 75: | ||
| </ | </ | ||
| - | this setup will pull in the same container setup both Ollama and Open WebUI. This allows for a seamless integration and neat organization in the server itself. | + | this setup will pull in the same container setup both Ollama and Open WebUI. This allows for a seamless integration and neat organization in the server itself. |
| - | This setup will let you access your Ollama instance from //outside// the container, on port 3081, which should **NOT** | + | This setup will let you access your Ollama instance from //outside// the container, on port 3081, which should **NOT** |
| + | |||
| + | |||
| + | ===== GPU acceleration support ===== | ||
| + | |||
| + | === Install NVIDIA drivers & tools === | ||
| + | |||
| + | Enable NVIDIA card by adding this line: | ||
| + | <file - / | ||
| + | VIDEO_CARDS=" | ||
| + | </ | ||
| + | (of course, put the cards you have, i have both an Intel and an NVIDIA). This step is probably not needed on an headless server, but having it defined will ensure that in the future it could be used. | ||
| + | |||
| + | Then disable the NVIDIA GUI tools, since the server is headless, put this into **/ | ||
| + | <file - nvidia> | ||
| + | x11-drivers/ | ||
| + | </ | ||
| + | |||
| + | Now emerge the required packages: | ||
| + | <code bash> | ||
| + | emerge -vp x11-drivers/ | ||
| + | </ | ||
| + | |||
| + | the **nvidia-drivers** is the actual driver, and **nvidia-container-toolkit** contains all the required files and stuff to enable passing the GPU to the container. More info can be found [[https:// | ||
| + | |||
| + | Now, check that the GPU is detected: | ||
| + | <code bash> | ||
| + | nvidia-smi | ||
| + | Mon Mar 2 16:34:45 2026 | ||
| + | [ ... lots of output with your GPU info, VRAM, etc... ] | ||
| + | </ | ||
| + | |||
| + | === Configure NVIDIA tools === | ||
| + | |||
| + | Disable cgroups (won't work for rootless podman) by editing the file / | ||
| + | < | ||
| + | [nvidia-container-cli] | ||
| + | ... | ||
| + | no-cgroups = true | ||
| + | ... | ||
| + | </ | ||
| + | leave the rest of the file untouched. | ||
| + | |||
| + | You need to generate a Common Device Interface (CDI) file which Podman will use to talk to the GPU (see [[https:// | ||
| + | <code bash> | ||
| + | nvidia-ctk cdi generate --output=/ | ||
| + | </ | ||
| + | |||
| + | you will need to **run again** the above command every time the NVIDIA drivers are updated. | ||
| + | |||
| + | At this point you should check the CDI is in place and working: | ||
| + | <code bash> | ||
| + | > nvidia-ctk cdi list | ||
| + | INFO[0000] Found 3 CDI devices | ||
| + | nvidia.com/ | ||
| + | nvidia.com/ | ||
| + | nvidia.com/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Configure podman passtrough === | ||
| + | |||
| + | To support GPU acceleration you need the two lines indicated in the compose file above. | ||
| + | |||
| + | This one: | ||
| + | < | ||
| + | devices: | ||
| + | - nvidia.com/ | ||
| + | </ | ||
| + | tells podman to pass all the GPUs to the container. You can actually select which one (if you have more than one) by selecting the appropriate one in the output of: | ||
| + | <code bash> | ||
| + | nvidia-ctk cdi list | ||
| + | INFO[0000] Found 3 CDI devices | ||
| + | nvidia.com/ | ||
| + | nvidia.com/ | ||
| + | nvidia.com/ | ||
| + | </ | ||
| + | |||
| + | This line instead: | ||
| + | < | ||
| + | annotations: | ||
| + | run.oci.keep_original_groups: | ||
| + | </ | ||
| + | is required because the container will forget the additional groups (of which **video** is required to access the GPU), and this annotation passes to the container the additional groups as well. | ||
| + | |||
| + | |||
| + | === Test GPU in container === | ||
| + | |||
| + | After restarting the container, this commans (as openwebui user) will tell you that all is well: | ||
| + | <code bash> | ||
| + | su - openwebui | ||
| + | podman exec -it ollama nvidia-smi | ||
| + | [ ... output similar to above ... ] | ||
| + | </ | ||
| Line 87: | Line 192: | ||
| proxy_set_header | proxy_set_header | ||
| proxy_set_header | proxy_set_header | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_buffering off; | ||
| + | proxy_set_header Upgrade $http_upgrade; | ||
| + | proxy_set_header Connection $connection_upgrade; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | proxy_set_header X-Accel-Internal / | ||
| + | access_log off; | ||
| } | } | ||
| - | |||
| include com.mydomain/ | include com.mydomain/ | ||
| } | } | ||