Running large language models locally has moved from a hobbyist experiment to a serious production option in 2026, largely because of Ollama. Unlike full training frameworks such as PyTorch or heavyweight inference engines built for distributed clusters, Ollama is a lightweight local inference runtime: install it, pull a model, and you have a private, API-accessible LLM running on hardware you fully control — no data leaving your infrastructure, no per-token API bill.
Quick answer: To deploy Ollama on a bare-metal server, provision a Linux server (Ubuntu or AlmaLinux recommended) with enough RAM and, for larger models, an NVIDIA GPU with sufficient VRAM. Install Ollama with the official install script, pull a model with ollama pull, then configure the built-in systemd service to bind to your network interface and sit behind a reverse proxy with TLS and authentication before exposing it beyond localhost.
This tutorial covers the full path from bare hardware to a secured, production-ready Ollama endpoint.
What Is Ollama, and Why Bare Metal?
Ollama packages model weights, a llama.cpp-based inference engine, and a simple REST API into a single binary. It's built specifically for inference, not training — which is the key distinction from a PyTorch or DeepSeek-V3 training pipeline. You're not building or fine-tuning a model from scratch here; you're serving an already-trained, open-weight model (Llama 3, Mistral, Qwen, Gemma, Phi, DeepSeek-R1 distills, and others) for local use.
Bare metal makes sense for this workload for a few concrete reasons:
No hypervisor tax on GPU memory. VRAM is the hard constraint for LLM inference, and virtualization overhead eats into it. A bare-metal GPU gives the full frame buffer to Ollama.
Predictable latency. Inference speed is sensitive to noisy neighbours on shared infrastructure; dedicated hardware removes that variable entirely.
Data residency and privacy. Prompts and outputs never leave your server, which matters for regulated industries or proprietary data.
Cost control at scale. A single bare-metal GPU server serving continuous inference traffic is usually cheaper than equivalent hosted API usage once volume grows.
Prerequisites
| Component | Minimum (CPU-only, 7B models) | Recommended (GPU, 13B–70B models) |
|---|---|---|
| OS | Ubuntu 22.04/24.04 LTS, AlmaLinux 9, Debian 12 | Same, with NVIDIA driver + CUDA support |
| RAM | 16 GB | 32–64 GB+ |
| Storage | 50 GB free (NVMe preferred) | 200 GB+ NVMe for multiple models |
| GPU | Not required | NVIDIA GPU with 16–80 GB VRAM depending on model size |
| Network | Standard port | Static IP if exposing the API externally |
Model VRAM requirements roughly follow this pattern for common quantization levels:
| Model size | Approx. VRAM needed (Q4) | Typical use case |
|---|---|---|
| 7B–8B | 6–10 GB | Chat assistants, summarization |
| 13B–14B | 10–16 GB | Coding assistants, RAG pipelines |
| 32B–34B | 20–24 GB | Higher-accuracy reasoning tasks |
| 70B | 40–48 GB | Advanced reasoning, production-grade output |
If you don't already have hardware provisioned, this is the point to choose between a CPU-only build for smaller models and a GPU-equipped server for anything above ~13B parameters.
Step 1: Provision the Right Bare-Metal Server
Match the server to the model tier you actually plan to run — over-provisioning a GPU server for a 7B model wastes budget, while under-provisioning VRAM for a 70B model will cause Ollama to fall back to slow CPU/RAM offloading.
For GPU-backed inference, look for a provider offering enterprise NVIDIA cards rather than consumer GPUs, since data-centre GPUs are validated for sustained 24/7 inference load and typically ship with more VRAM. eServers UK's GPU dedicated servers are a relevant example here: they offer a choice of NVIDIA L4, A100, and H100 Tensor Core GPUs, come with NVMe storage as standard to avoid I/O bottlenecks during model loading, and give full root access so you can install NVIDIA drivers and CUDA yourself. For reference:
NVIDIA L4 — efficient choice for 7B–13B inference workloads at lower cost.
NVIDIA A100 — solid mid-to-large model territory (32B–70B with quantization).
NVIDIA H100 — headroom for the largest open-weight models and higher concurrent request volume.
If your workload is smaller and CPU-only inference is acceptable (7B models quantized to Q4 run reasonably on modern CPUs), a standard bare-metal dedicated server with sufficient RAM is a more cost-effective starting point, and you can move to a GPU tier later without changing your deployment process.
Step 2: Prepare the Server
Connect via SSH and bring the system up to date first.
sudo apt update && sudo apt upgrade -y
If you're on a GPU server, install the NVIDIA driver and confirm the GPU is visible before installing Ollama — this saves time debugging later.
sudo apt install -y ubuntu-drivers-common
sudo ubuntu-drivers autoinstall
sudo reboot
After reboot, confirm the driver loaded correctly:
nvidia-smi
You should see your GPU model, driver version, and available VRAM listed. Ollama detects and uses the GPU automatically once the driver is present — no manual CUDA toolkit installation is required for standard Ollama use, since it ships with the necessary runtime libraries bundled.
Step 3: Install Ollama
Ollama provides an official install script that handles the binary, a dedicated system user, and a systemd service in one step.
curl -fsSL https://ollama.com/install.sh | sh
Once complete, confirm the service is running:
systemctl status ollama
By default, Ollama binds to 127.0.0.1:11434 — accessible only from the server itself. That's intentional; we'll open it up deliberately and securely in Step 6.
Step 4: Pull and Run Your First Model
With the service running, pull a model. Model size names correspond to parameter count and quantization level.
ollama pull llama3.1:8b
Run it interactively to confirm inference works end-to-end:
ollama run llama3.1:8b
You should get a prompt where you can chat with the model directly in the terminal. Type /bye to exit.
For a GPU server, verify the model is actually using the GPU rather than falling back to CPU:
nvidia-smi
While a prompt is processing, you should see GPU utilization and memory usage climb. If it stays at zero, double-check the driver installation from Step 2.
Step 5: Configure Ollama for Production Use
The default configuration is fine for local testing but needs adjustment for a real deployment. Edit the systemd service with an override rather than modifying the unit file directly, so updates don't overwrite your changes.
sudo systemctl edit ollama
Add the following, adjusting values to your environment:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_ORIGINS=https://yourdomain.com"
Environment="OLLAMA_KEEP_ALIVE=10m"
Environment="OLLAMA_MAX_LOADED_MODELS=2"
OLLAMA_HOSTcontrols which interface and port the API listens on.OLLAMA_ORIGINSrestricts which web origins can call the API directly from a browser — set this narrowly, not to*, in production.OLLAMA_KEEP_ALIVEcontrols how long a model stays loaded in memory/VRAM after the last request, trading idle resource usage against response latency on the next call.OLLAMA_MAX_LOADED_MODELScaps how many models can be resident simultaneously, preventing VRAM exhaustion if multiple models are requested.
Apply the changes:
sudo systemctl daemon-reload
sudo systemctl restart ollama
Step 6: Expose the API Securely
Binding to 0.0.0.0 alone is not sufficient for anything internet-facing — Ollama's API has no built-in authentication. Put it behind a reverse proxy that handles TLS and access control.
A minimal Nginx configuration with basic authentication:
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
location / {
auth_basic "Restricted API";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:11434;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Generate the credentials file and issue a certificate:
sudo apt install -y apache2-utils certbot python3-certbot-nginx
sudo htpasswd -c /etc/nginx/.htpasswd apiuser
sudo certbot --nginx -d yourdomain.com
Finally, lock down the firewall so port 11434 is never reachable directly — only 443 (HTTPS) should be open externally.
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
sudo ufw enable
For higher-security deployments, consider an API-key header check in Nginx or an upstream API gateway instead of basic auth, and restrict access further with an IP allowlist if the API only needs to be reached from known application servers.
Step 7: Test the API
From another machine, confirm the endpoint responds correctly:
curl -u apiuser:yourpassword https://yourdomain.com/api/generate -d '{
"model": "llama3.1:8b",
"prompt": "Summarise the key steps for deploying a local LLM.",
"stream": false
}'
A successful response returns a JSON object containing the generated text along with token counts and timing metadata — confirmation that the model is reachable over the network through the secured endpoint rather than only on localhost.
Performance Tuning Notes
A few adjustments make a measurable difference once you move past initial testing:
Match quantization to hardware. Q4_K_M offers a strong accuracy-to-size trade-off for most use cases; Q8 or FP16 variants need considerably more VRAM for marginal quality gains.
Adjust context length deliberately. Larger
num_ctxvalues consume more memory per request — set it to what your application actually needs rather than the model's maximum by default.Watch concurrent request load. Ollama queues requests per loaded model; for higher throughput, consider running multiple model instances behind a load balancer rather than expecting one instance to scale indefinitely.
Pin OLLAMA_KEEP_ALIVE based on traffic pattern. Bursty, low-frequency traffic benefits from a shorter keep-alive to free VRAM between requests; steady traffic benefits from keeping the model resident.
Monitoring and Maintenance
Keep an eye on both the service and the hardware it's running on:
journalctl -u ollama -f # live service logs
nvidia-smi -l 5 # GPU utilization every 5 seconds
ollama list # installed models and sizes
Update Ollama periodically by re-running the install script — it detects the existing installation and upgrades in place without removing pulled models.
curl -fsSL https://ollama.com/install.sh | sh
Ollama vs. Full Training Stacks: Setting Expectations
It's worth being explicit about scope: this deployment pattern is for inference, not training or fine-tuning. If your goal is training a model like DeepSeek-V3 from scratch or fine-tuning with a PyTorch pipeline, you're looking at a fundamentally different hardware profile — multi-GPU clusters, high-bandwidth interconnects, and distributed training frameworks. Ollama deliberately avoids that complexity; it's built to make a trained, open-weight model usable in production with minimal setup, which is exactly why it fits a single bare-metal server rather than a cluster.
Security Checklist
Before considering the deployment production-ready, confirm:
Ollama's default port (11434) is not exposed directly to the internet
The reverse proxy enforces TLS and authentication
OLLAMA_ORIGINSis restricted to known origins, not wildcardedThe firewall only allows required inbound ports
The server OS and NVIDIA drivers are on a regular patch schedule
Model downloads are pulled from Ollama's official library, not untrusted third-party sources
Conclusion
With the model serving securely behind your own domain, the remaining work is mostly operational: monitoring GPU headroom as usage grows and picking the right hardware tier before you outgrow it. If you're scaling beyond a single model or need more VRAM, eServers UK's GPU dedicated servers support NVIDIA L4 through H100 configurations on the same bare-metal foundation this tutorial is built on.
Frequently Asked Questions
Does Ollama require a GPU?
No. Ollama runs on CPU-only servers for smaller models (typically up to around 8B parameters at usable speed), but a GPU is strongly recommended for anything larger or for production-grade response times.
Can Ollama run multiple models at once?
Yes, up to the limit set by OLLAMA_MAX_LOADED_MODELS, provided there's enough combined VRAM or RAM to hold them simultaneously.
Is Ollama suitable for training or fine-tuning models?
No. Ollama is an inference-only runtime. Training and fine-tuning require frameworks like PyTorch alongside significantly more compute, typically across multiple GPUs.
How is this different from running Ollama on a cloud VM?
Functionally similar, but a bare-metal server gives dedicated access to the full GPU/VRAM without virtualization overhead, more predictable performance under sustained load, and — depending on the provider — a more cost-effective option for continuous inference traffic compared to hourly cloud GPU billing.
What's the easiest way to secure the Ollama API for a small team?
A reverse proxy with TLS and basic authentication (as shown in Step 6) is sufficient for small, trusted-team use. For broader or public-facing deployments, move to proper API-key management or an API gateway with rate limiting.
Discover eServers Dedicated Server Locations
eServers provides reliable dedicated servers across multiple global regions. Whether you need low latency, regional compliance, or proximity to your audience, our wide geographic coverage ensures the perfect hosting environment for your project.