1. Overview
This guide shows how to:
- Install Docker on Arch Linux (CachyOS).
- Deploy the containerized open‑webui front‑end and connect it to a local Ollama server.
- Enable ROCm for the AMD GPU and run Ollama in mixed GPU + CPU mode.
- Configure Ollama as a systemd service with the custom environment you provided.
- Apply optimal model parameters for the 120 B‑parameter GPT‑OSS model.
- Set a system prompt that enforces the desired behaviour.
All commands assume you are using a regular user with sudo privileges.
First what we need is to Install Linux OS
2. Prerequisites
3. System Update & ROCm Packages
# Full system upgrade
sudo pacman -Syusudo pacman -S rocm-hip-sdk rocm-opencl-sdkThe ROCm stack provides the hip runtime and OpenCL drivers needed for the RX 7900 XTX.
4. Install Ollama
sudo pacman -S ollamaAfter installation, verify the binary:ollama --version
5. Install Docker
sudo pacman -S dockersudo systemctl enable --now dockerAdd your user to the docker group to avoid sudo for each command:sudo usermod -aG docker $USERnewgrp docker # reload groups
6. Deploy open‑webui (Docker)
Create a directory for the UI configuration:mkdir -p ~/openwebui && cd ~/openwebui
Create a simple docker-compose.yml:
version: "3.8"services: openwebui: image: ghcr.io/open-webui/open-webui:latest container_name: openwebui ports: - "8080:8080" environment: - OLLAMA_HOST=http://host.docker.internal:11434 # Connect to local Ollama restart: unless-stoppedStart the stack:docker compose up -d
Open http://localhost:8080 in a browser – the UI will forward requests to the Ollama server running on the host.
7. Configure Ollama Systemd Service (Mixed GPU + CPU)
Create a drop‑in directory for custom settings:sudo mkdir -p /etc/systemd/system/ollama.service.d
sudo nano /etc/systemd/system/ollama.service.d/custom.conf
Paste the following content (exactly as you provided):
[Service]Environment="OLLAMA_HOST=0.0.0.0"Environment="HSA_OVERRIDE_GFX_VERSION=11.0.0"Environment="ROCM_VISIBLE_DEVICES=0"Environment="OLLAMA_KEEP_ALIVE=10m"Environment="OLLAMA_MAX_VRAM=24GiB"Environment="OMP_NUM_THREADS=24"Environment="KMP_AFFINITY=granularity=fine,compact,1,0"Reload systemd and restart Ollama:sudo systemctl daemon-reload
sudo systemctl enable --now ollama
You can verify that Ollama is listening on all interfaces:ss -tlnp | grep 11434
The environment variables enable:
- GPU detection (
ROCM_VISIBLE_DEVICES) – selects the first AMD device. - Mixed‑mode execution – the
HSA_OVERRIDE_GFX_VERSIONandKMP_AFFINITYflags let the runtime use both GPU and CPU cores efficiently. - Memory limits (
OLLAMA_MAX_VRAM=24GiB) – caps VRAM usage to leave headroom for the system.
8. Pull & Run the GPT‑OSS‑120B Model
Ollama stores models in its own registry. Assuming the model is available as gpt-oss-120b:ollama pull gpt-oss-120b
Create a configuration file for the model (optional but convenient):mkdir -p ~/.ollama/models/gpt-oss-120b
cat > ~/.ollama/models/gpt-oss-120b/config.yaml <<EOF
num_ctx: 8192
temperature: 0.7
top_p: 0.9
top_k: 40
repeat_penalty: 1.1
system_prompt: |
You are GPT-OSS-120B, a highly capable open-source language model. Follow these rules: 1. Be concise, factual, and logically structured. 2. Give direct answers before optional detail. 3. Use bullet points when listing information. 4. Avoid filler, disclaimers, and unnecessary explanations. 5. When reasoning, think step‑by‑step internally and present only the final result. 6. Avoid hallucinating by admitting when information is unknown. 7. Prioritize accuracy, clarity, and practicality. You behave as a helpful expert assistant with strong reasoning ability.EOFRestart Ollama to load the new config:sudo systemctl restart ollama
Now the UI (open‑webui) will use the 120 B model with the parameters you specified.
9. Verify GPU Utilisation
Install rocm-smi to monitor the AMD GPU:sudo pacman -S rocm-smi
watch -n 1 rocm-smi
When you send a request from the UI, you should see GPU memory usage rise (up to the 24 GiB limit) while CPU threads are also active, confirming mixed‑mode operation.
10. Troubleshooting Tips
11. Full Command Summary
sudo pacman -Syusudo pacman -S rocm-hip-sdk rocm-opencl-sdksudo pacman -S ollamasudo pacman -S dockersudo systemctl enable --now dockersudo usermod -aG docker $USERmkdir -p ~/openwebui && cd ~/openwebuicat > docker-compose.yml <<'EOF'version: "3.8"services: openwebui: image: ghcr.io/open-webui/open-webui:latest container_name: openwebui ports: - "8080:8080" environment: - OLLAMA_HOST=http://host.docker.internal:11434 # Connect to local Ollama restart: unless-stoppeddocker compose up -dsudo mkdir -p /etc/systemd/system/ollama.service.dsudo tee /etc/systemd/system/ollama.service.d/custom.conf > /dev/null <<'EOF'[Service]Environment="OLLAMA_HOST=0.0.0.0"Environment="HSA_OVERRIDE_GFX_VERSION=11.0.0"Environment="ROCM_VISIBLE_DEVICES=0"Environment="OLLAMA_KEEP_ALIVE=10m"Environment="OLLAMA_MAX_VRAM=24GiB"Environment="OMP_NUM_THREADS=24"Environment="KMP_AFFINITY=granularity=fine,compact,1,0"EOFsudo systemctl daemon-reloadsudo systemctl enable --now ollamaollama pull gpt-oss-120bmkdir -p ~/.ollama/models/gpt-oss-120bcat > ~/.ollama/models/gpt-oss-120b/config.yaml <<'EOF'num_ctx: 8192temperature: 0.7top_p: 0.9top_k: 40repeat_penalty: 1.1system_prompt: | You are GPT-OSS-120B, a highly capable open-source language model. Follow these rules: 1. Be concise, factual, and logically structured. 2. Give direct answers before optional detail. 3. Use bullet points when listing information. 4. Avoid filler, disclaimers, and unnecessary explanations. 5. When reasoning, think step‑by‑step internally and present only the final result. 6. Avoid hallucinating by admitting when information is unknown. 7. Prioritize accuracy, clarity, and practicality. You behave as a helpful expert assistant with strong reasoning ability.EOFsudo systemctl restart ollama12. Conclusion
You now have a fully functional local LLM stack on Arch Linux (CachyOS) that:
- Leverages the AMD Radeon RX 7900 XTX via ROCm.
- Runs the GPT‑OSS‑120B model in mixed GPU + CPU mode for optimal performance.
- Provides a web‑based chat UI through open‑webui.
Feel free to tweak the environment variables (e.g., OMP_NUM_THREADS or OLLAMA_MAX_VRAM) to match future hardware upgrades. Happy prompting!