Technical Tutorials
How to Deploy and Self-Host Llama 3 on a Cheap Cloud VPS with Ollama and Docker
Step-by-step technical guide to self-hosting quantized Llama 3 8B on an affordable VPS instance with Ollama, Open WebUI, and secure SSL.

1. Hardware Prerequisites & VPS Selection
To run quantized Llama 3 8B (Q4_K_M) at 20-30 tokens/sec on CPU inference, you need a minimum of 4 modern vCPUs (AMD EPYC or Ryzen) and 8 GB RAM with NVMe storage.
Verified Partner Offer
Check Ryzen VPS Plans on AlphaVPS (from €3.50/mo)AlphaVPS
High-frequency AMD Ryzen nodes with 10% lifetime discount
Affiliate link: we earn a commission if you subscribe, at no extra cost to you.
2. Docker Compose Configuration for Ollama & Open WebUI
Create a project directory on your Linux instance and launch this compose stack:
docker-compose.yml
version: '3.8'
services:
ollama:
image: ollama/ollama:latest
container_name: nexalabs-ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ./ollama_data:/root/.ollama
environment:
- OLLAMA_KEEP_ALIVE=24h
- OLLAMA_NUM_PARALLEL=4
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: nexalabs-webui
restart: unless-stopped
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- ./webui_data:/app/backend/data
depends_on:
- ollama3. Model Download and REST API Testing
Run the following commands to pull and verify your self-hosted LLM endpoint:
Terminal do Servidor
# Levantar los contenedores en segundo plano
docker compose up -d
# Descargar Llama 3 (8B) optimizado
docker exec -it nexalabs-ollama ollama run llama3
# Probar la API compatible con OpenAI desde curl
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama3",
"messages": [{"role": "user", "content": "Explica la computación cuántica en una frase"}]
}'Frequently Asked Questions
How much does it cost to host this monthly?
On AlphaVPS or Hostinger, an 8GB RAM Ryzen node costs around €7–€12/month, with zero per-token API charges.