Requirements
You need a Linux VPS with at least 16 GB RAM (32 GB recommended). CPU-only inference is surprisingly usable for personal use.
# Tested on Ubuntu 22.04 LTS
# RAM: 16–32 GB | CPU: 4–8 cores
# Monthly cost: ~€15–25 (Hetzner CX32 / OVH Advance)Install llama.cpp
Build from source for best CPU performance with OpenBLAS acceleration.
sudo apt update && sudo apt install -y build-essential cmake libopenblas-dev
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
cmake -B build -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS
cmake --build build --config Release -j$(nproc)Download the model
Use Q4_K_M for the best accuracy/size tradeoff on limited RAM. The 8B model fits easily in 16 GB.
pip install huggingface_hub
huggingface-cli download bartowski/Meta-Llama-3.1-8B-Instruct-GGUF \
--include "Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf" \
--local-dir ./modelsStart the server
Run llama.cpp in server mode on port 8080. Add an API key for basic auth.
./build/bin/llama-server \
-m ./models/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf \
--host 0.0.0.0 --port 8080 \
-c 8192 \
-t $(nproc) \
--api-key "your-secret-key"Related guides
CPU Inference: OpenBLAS Tuning for llama.cpp
Maximize tokens/sec on a CPU-only VPS with thread count and BLAS backend tuning.
Nginx Reverse Proxy for Local LLM APIs
Put Ollama or llama.cpp behind Nginx with TLS, rate limiting, and a stable /v1 endpoint for your apps.
Multi-Model API Server on RTX 4090 with vLLM
Serve multiple AWQ-quantized models with vLLM's continuous batching for production-grade throughput.