====== Clawbox + Ollama - Lokale LLMs für OpenClaw ======
Diese Anleitung zeigt, wie du **Ollama** in einer Clawbox-VM installierst, um lokale LLMs (Large Language Models) mit OpenClaw zu nutzen.
===== Übersicht =====
^ Komponente ^ Zweck ^
| Clawbox | macOS VM mit OpenClaw |
| Ollama | Lokaler LLM-Server (Llama, Mistral, etc.) |
| OpenClaw | Nutzt Ollama als lokalen Model-Provider |
**Vorteile:**
* Keine API-Kosten
* Vollständig lokal & privat
* Keine Internetverbindung nötig (nach Download)
===== Voraussetzungen =====
^ Anforderung ^ Empfehlung ^
| RAM (Host) | 16GB+ (8GB für VM + 8GB für Modelle) |
| RAM (VM) | 8GB+ für kleine Modelle |
| Speicher | 10-50GB für Modelle |
| Apple Silicon | Optimiert für M1/M2/M3 |
**Wichtig:** LLMs brauchen viel RAM. Plane:
* 4-8GB RAM für kleine Modelle (Llama 3.2 3B, Phi-3)
* 16GB+ RAM für mittlere Modelle (Llama 3.1 8B, Mistral 7B)
* 32GB+ RAM für große Modelle (Llama 3.1 70B quantized)
===== Schnellstart =====
==== 1. Clawbox VM erstellen ====
# Auf dem Host (Mac Mini / MacBook)
brew install joshavant/tap/clawbox
clawbox image build
clawbox up --add-playwright-provisioning
==== 2. In die VM einloggen ====
# SSH in die VM
ssh clawbox-1@$(clawbox ip 1)
# Passwort: clawbox
==== 3. Ollama installieren ====
In der VM:
# Ollama installieren
curl -fsSL https://ollama.com/install.sh | sh
# Ollama Service starten
ollama serve &
Oder als Hintergrund-Service:
# LaunchAgent erstellen
cat > ~/Library/LaunchAgents/com.ollama.ollama.plist << 'EOF'
Label
com.ollama.ollama
ProgramArguments
/opt/homebrew/bin/ollama
serve
RunAtLoad
KeepAlive
EOF
# Service laden
launchctl load ~/Library/LaunchAgents/com.ollama.ollama.plist
==== 4. Modell herunterladen ====
# Kleines Modell (schnell, wenig RAM)
ollama pull llama3.2:3b
# Mittelgroßes Modell (ausgewogen)
ollama pull llama3.1:8b
# Code-spezifisch
ollama pull codellama:7b
# Liste alle verfügbaren Modelle
ollama list
==== 5. OpenClaw konfigurieren ====
In der VM, OpenClaw konfigurieren:
# OpenClaw onboarden (falls noch nicht geschehen)
openclaw onboard --install-daemon
# Modell in OpenClaw konfigurieren
openclaw config set model ollama:llama3.2:3b
Oder in der ''~/.openclaw/config.json'':
{
"model": "ollama:llama3.2:3b",
"ollama": {
"baseUrl": "http://localhost:11434"
}
}
===== Modelleübersicht =====
==== Empfehlungen für Apple Silicon ====
^ Modell ^ Größe ^ RAM ^ Geschwindigkeit ^ Nutzung ^
| ''llama3.2:3b'' | ~2GB | 4GB | Sehr schnell | Chat, einfache Tasks |
| ''llama3.2:1b'' | ~1.3GB | 2GB | Extrem schnell | Quick responses |
| ''llama3.1:8b'' | ~4.7GB | 8GB | Schnell | Allround, guter Balance |
| ''mistral:7b'' | ~4.1GB | 8GB | Schnell | Allround, europäisch |
| ''codellama:7b'' | ~3.8GB | 8GB | Mittel | Code-Generierung |
| ''phi3:mini'' | ~2.2GB | 4GB | Sehr schnell | Logik, Reasoning |
| ''gemma2:9b'' | ~5.5GB | 10GB | Mittel | Gute Qualität |
==== Download ====
# Standard-Download
ollama pull llama3.2:3b
# Spezifische Version
ollama pull llama3.1:8b-instruct
# Alle Varianten anzeigen
ollama show llama3.1 --modelfile
===== Ollama Befehle =====
^ Befehl ^ Beschreibung ^
| ''ollama pull '' | Modell herunterladen |
| ''ollama run '' | Modell starten & chatten |
| ''ollama list'' | Installierte Modelle |
| ''ollama rm '' | Modell löschen |
| ''ollama ps'' | Laufende Modelle |
| ''ollama serve'' | Server starten |
| ''ollama show '' | Modell-Details |
===== RAM-Management =====
==== Nur ein Modell zur Zeit ====
Ollama lädt Modelle bei Bedarf und entlädt sie nach Inaktivität. Standard: 5 Minuten.
# Keep-alive Zeit ändern (z.B. 10 Minuten)
ollama run llama3.2:3b --keepalive 10m
# Sofort entladen
ollama stop llama3.2:3b
==== In der VM ====
Wenn du mehrere Modelle hast, acht auf den RAM:
# VM-RAM prüfen
vm_stat | perl -ne '/page size of (\d+)/ and $ps=$1; /Pages free:\s+(\d+)/ and printf "Free: %.1f GB\n", $1*$ps/1073741824'
# Modell-Größen anzeigen
ollama list
===== OpenClaw + Ollama Integration =====
==== OpenClaw Model-Aliase ====
OpenClaw unterstützt verschiedene Schreibweisen:
ollama:llama3.2:3b # Vollständig
ollama://localhost/llama3.2 # Kurzform
==== Streaming aktivieren ====
Standardmäßig streamt Ollama Antworten. In OpenClaw:
{
"model": "ollama:llama3.2:3b",
"streaming": true
}
==== Custom API-Endpoint ====
Wenn Ollama nicht auf localhost läuft:
{
"ollama": {
"baseUrl": "http://192.168.1.100:11434"
}
}
===== Troubleshooting =====
==== Ollama startet nicht ====
# Prüfen ob Port belegt
lsof -i :11434
# Manuell starten mit Log
OLLAMA_DEBUG=1 ollama serve
# Logs prüfen
tail -f ~/.ollama/logs/server.log
==== Modell lädt langsam ====
# Modell ist zu groß für RAM → Swap
# Lösung: Kleineres Modell verwenden
ollama pull llama3.2:3b # statt 8b
==== Out of Memory ====
# Laufende Modelle prüfen
ollama ps
# Modell entladen
ollama stop
# VM neu starten
clawbox down 1 && clawbox up
==== OpenClaw findet Ollama nicht ====
# Ollama läuft?
curl http://localhost:11434/api/tags
# Antwort sollte Modelle zeigen
===== Performance-Tipps =====
==== 1. Passendes Modell wählen ====
* **Mac Mini M1 16GB:** llama3.1:8b oder mistral:7b
* **Mac Mini M1 8GB:** llama3.2:3b oder phi3:mini
==== 2. Quantisierung nutzen ====
Ollama nutzt automatisch quantisierte Modelle (Q4_K_M):
# Verschiedene Quantisierungen
ollama pull llama3.1:8b-q4_0 # Schneller, weniger Qualität
ollama pull llama3.1:8b-q8_0 # Langsamer, mehr Qualität
==== 3. GPU-Beschleunigung ====
Apple Silicon nutzt automatisch Metal GPU-Beschleunigung:
# Prüfen
OLLAMA_DEBUG=1 ollama run llama3.2:3b
# Sollte zeigen: "GPU available"
===== Alternativ: Ollama auf dem Host ====
Wenn du Ollama auf dem **Host** statt in der VM laufen lassen willst:
==== Host (Mac Mini) ====
# Ollama auf Host installieren
curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3.2:3b
ollama serve
==== VM (Clawbox) ====
# In der VM: OpenClaw auf Host-Ollama verweisen
# Host-IP ermitteln (im Host: clawbox ip 1 zeigt VM-IP)
# Host ist vom Default-Gateway erreichbar
# OpenClaw config
openclaw config set ollama.baseUrl http://192.168.64.1:11434
**Vorteil:** Host hat mehr RAM für Modelle.
**Nachteil:** VM ist abhängig vom Host.
===== Automatisierung =====
==== Setup-Script für VM ====
#!/bin/bash
# in der VM ausführen
# Ollama installieren
curl -fsSL https://ollama.com/install.sh | sh
# LaunchAgent erstellen
mkdir -p ~/Library/LaunchAgents
cat > ~/Library/LaunchAgents/com.ollama.ollama.plist << 'EOF'
Label
com.ollama.ollama
ProgramArguments
/opt/homebrew/bin/ollama
serve
RunAtLoad
KeepAlive
EOF
# Service starten
launchctl load ~/Library/LaunchAgents/com.ollama.ollama.plist
# Warten bis Ollama bereit
sleep 5
# Standard-Modell laden
ollama pull llama3.2:3b
echo "Ollama ist bereit!"
ollama list
===== Links =====
* [[https://github.com/joshavant/clawbox|Clawbox GitHub]]
* [[https://ollama.com|Ollama Website]]
* [[https://ollama.com/library|Ollama Model Library]]
* [[https://docs.openclaw.ai|OpenClaw Docs]]
* [[clawbox|Clawbox Hauptanleitung]]
--- //[[admin@thepain.dev|Klaus]] 2026/02/28 12:40//