Building High-Performance AI Infrastructure on Linux: From NVIDIA Drivers to vLLM Production Deployments
The modern Machine Learning landscape relies entirely on Linux infrastructure. While high-level framework developments like PyTorch, Hugging Face, and LangChain dominate developer discussions, the actual engine serving low-latency inference at scale sits directly on Linux kernels, GPU acceleration drivers, and containerized serving engines.
In this guide, we will step through the core architecture required to turn a raw Linux server (Ubuntu/Debian or RHEL/Rocky) into a high-throughput, OpenAI-compatible AI inference endpoint using vLLM and Docker.
1. Prerequisites & Linux Kernel Preparation
Before running any Large Language Model (LLM) inference engine, your host operating system must be properly configured with NVIDIA proprietary drivers and the NVIDIA Container Toolkit to allow Docker containers direct access to host GPU acceleration.
Step 1.1: Verify GPU Hardware
Ensure your host system correctly detects all installed NVIDIA GPUs:
# Check PCI bus for recognized NVIDIA graphics hardware
lspci | grep -i nvidia
Step 1.2: Install NVIDIA Drivers & Container Toolkit
On an Ubuntu 24.04/22.04 LTS host system, install the headless server driver and container runtime:
# Update local package index
sudo apt update && sudo apt upgrade -y
# Install NVIDIA headless server driver
sudo apt install -y nvidia-driver-550-server
# Add NVIDIA Container Toolkit repository
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/experimental/deb/nvidia-container-toolkit.list | \
sed 's#deb [^ ]* #&[signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] #' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
# Install toolkit and restart Docker daemon
sudo apt update
sudo apt install -y nvidia-container-toolkit
sudo systemctl restart docker
Step 1.3: Verify CUDA & GPU Passthrough
Verify that the driver and Docker GPU runtime are properly communicating with the hardware:
# Verify host driver status
nvidia-smi
# Verify container GPU passthrough
docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smi
2. Choosing Your Serving Layer: Ollama vs. vLLM
When deploying local or open-weights models on Linux, selecting the appropriate inference server depends on your workload target:
| Feature | Ollama | vLLM |
| Primary Use Case | Local development, CLI tools, rapid prototyping | Enterprise production, multi-user concurrent APIs |
| Memory Management | Dynamic single-request allocation | PagedAttention (prevents memory fragmentation) |
| Multi-GPU Parallelism | Basic | Advanced (Tensor & Pipeline Parallelism) |
| Throughput Target | Low concurrency (1–5 users) | High concurrency (100+ requests/sec) |
For production cloud infrastructure, vLLM is the industry standard engine due to its throughput optimizations and native OpenAI API endpoint compatibility.
3. Deploying a vLLM Inference Container
Let’s deploy an open-weights model using vLLM inside Docker. This setup exposes an OpenAI-compatible HTTP REST endpoint on port 8000.
Step 3.1: Launching the Engine
Execute the following docker run command to spin up the serving engine:
docker run -d \
--name vllm-server \
--gpus all \
--ipc=host \
-p 8000:8000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
vllm/vllm-openai:latest \
--model Qwen/Qwen2.5-7B-Instruct \
--gpu-memory-utilization 0.90 \
--max-model-len 8192
Breakdown of Key Parameters:
--ipc=host: Shares host inter-process communication memory, crucial for multi-GPU communication.-v ~/.cache/huggingface:...: Caches downloaded model weights directly on host storage to prevent redundant downloads.--gpu-memory-utilization 0.90: Reserves 90% of VRAM for weight storage and KV-cache execution.
4. Testing Your API Endpoint
Once the container finishes loading model weights into VRAM (check logs with docker logs -f vllm-server), test the endpoint using standard curl commands:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen2.5-7B-Instruct",
"messages": [
{"role": "system", "content": "You are a senior Linux DevOps systems engineer."},
{"role": "user", "content": "Explain how systemd manages background service processes."}
],
"temperature": 0.7
}'
5. Production Hardening with Systemd
To ensure your AI endpoint automatically recovers from system reboots or driver crashes, wrap your deployment inside a native Linux systemd service unit.
Create the service file /etc/systemd/system/vllm.service:
[Unit]
Description=vLLM Inference Service
After=docker.service
Requires=docker.service
[Service]
Restart=always
RestartSec=10s
ExecStartPre=-/usr/bin/docker stop vllm-server
ExecStartPre=-/usr/bin/docker rm vllm-server
ExecStart=/usr/bin/docker run --name vllm-server \
--gpus all \
--ipc=host \
-p 8000:8000 \
-v /var/cache/huggingface:/root/.cache/huggingface \
vllm/vllm-openai:latest \
--model Qwen/Qwen2.5-7B-Instruct \
--gpu-memory-utilization 0.90 \
--max-model-len 8192
ExecStop=/usr/bin/docker stop vllm-server
[Install]
WantedBy=multi-user.target
Enable and start your systemd unit:
# Reload systemd configuration
sudo systemctl daemon-reload
# Enable service auto-start on host boot
sudo systemctl enable --now vllm.service
# Check live system daemon status
sudo systemctl status vllm.service
Conclusion & Next Steps
Setting up a resilient Linux host environment for AI inference requires proper GPU driver integration, efficient container routing, and memory-managed serving architectures like vLLM.
By running your model workloads within systemd-managed containers, you create a scalable, self-healing foundation ready to handle production API traffic behind an Nginx or Traefik reverse proxy.
Comments