Ollama VPS Hosting: Choose Hardware and Keep the API Private
Choose an Ollama VPS by model, quantization, context and measured workload; keep its API private with loopback publishing and an SSH tunnel.
The short answer
Ollama can run local models on a VPS if the selected model, context and concurrent requests fit its available resources. CPU-only inference is possible, but it is not a performance guarantee. For a private deployment, keep the local API off the public internet, use a compatible model and measure response time with your own prompts before buying a long hosting term.

Reading options
On this page
- Separate CPU inference from GPU inference
- Define the workload before choosing RAM
- Keep the API private first
- Download a model you have deliberately chosen
- Measure context and waiting time
- Add a gateway only when it is needed
- Troubleshoot without opening the backend
- Reader questions
- Sources & further reading
Before you start
Authorized VPS and SSH access, Docker, a reviewed image and an approved local model with sufficient resources. Examples are unexecuted.
The common buying mistake is to compare a VPS's RAM with a model's download size and stop there. Runtime memory also depends on context, parallel work and the inference configuration. A model fitting on disk does not prove it will run comfortably.
This guide is for an administrator evaluating a private, single-user local-model service. It does not establish a production model size for any Hostlelo plan. The useful end state is a model that passes your task-quality and response-time checks while its unauthenticated API remains inaccessible from the public internet. All deployment and inspection examples below are unexecuted.
Separate CPU inference from GPU inference
The Ollama Docker documentation provides both CPU-only and GPU deployment paths. A GPU deployment requires actual compatible hardware and the relevant drivers or container runtime; an ordinary VPS plan does not acquire a GPU when you install a driver.
Question | Why you need an answer |
|---|---|
Which exact model and quantization will run? | They affect memory use and output quality |
How much context will each request use? | A larger context increases memory demand |
How many requests may run together? | Parallel work changes capacity and waiting time |
Is compatible GPU hardware actually assigned? | CPU specifications alone do not establish GPU capability |
Is the model license suitable for this use? | The model and serving application have separate terms |
Use Ollama's hardware support list for compatibility. We have not benchmarked any Hostlelo server or model for this article.
Define the workload before choosing RAM
Write down the task, the longest realistic input, the expected output length and the number of users who may arrive together. A short classification job can accept a queued response; an interactive assistant may need a much shorter wait. These are decision examples, not measured performance claims. Start with the smallest candidate that meets the task, rather than choosing the largest model a plan might load.
Quantization stores model weights at reduced precision. It can reduce storage and memory requirements, but the format also affects speed and output quality; a smaller download is not a free upgrade. Compare the same task across candidate quantizations and keep the one that still passes your checks. The llama.cpp quantization documentation describes these trade-offs; its published measurements are not benchmarks of your VPS.
Budget separately for model weights, context/KV-cache state, runtime working memory, and the operating system or other services. Do not treat these as a fixed percentage overhead. Longer context and simultaneous requests change the budget, and GPU VRAM is a different limit from the VPS's system RAM. Disk space must also accommodate the selected downloads, updates and logs. Leave operating headroom instead of making a successful load your only pass criterion.
Ask the provider whether vCPUs are shared or dedicated, whether sustained inference is permitted, and whether CPU, memory or disk throughput is subject to limits. A vCPU count alone is not a tokens-per-second specification. Test at different times if scheduling contention is possible. For GPU hosting, obtain the exact device, assigned VRAM and supported driver/runtime details in writing; do not infer them from an “AI-ready” label.
Choose an explicit context target that covers your application's instructions, history, input and output budget. Inspect the effective allocation rather than assuming every Ollama release or machine uses the same default. Context-length guidance confirms the memory trade-off. Start the pilot with one loaded model and one request at a time, then change one capacity variable per test.
Keep the API private first

Ollama's authentication documentation states that its local API does not require authentication. Publishing that API openly can expose your inference resources and any functionality available through the service.
The following unexecuted CPU-only example adapts the official Docker approach for a dedicated evaluation VPS. It uses ordinary Docker bridge networking, loopback-only host publishing, a reviewed image and one model/request at a time. It is not a multi-user production gateway. Confirm sufficient disk and memory and retain administrative access before starting; do not run an unbounded model test beside a production database or customer site.
export OLLAMA_IMAGE='ollama/ollama:REPLACE_WITH_REVIEWED_VERSION'
docker run -d \
--name ollama \
--restart unless-stopped \
-e OLLAMA_NO_CLOUD=1 \
-e OLLAMA_NUM_PARALLEL=1 \
-e OLLAMA_MAX_LOADED_MODELS=1 \
-v ollama_data:/root/.ollama \
-p 127.0.0.1:11434:11434 \
"$OLLAMA_IMAGE"Replace the image placeholder before running it. OLLAMA_NO_CLOUD=1 selects the documented local-only behavior; it does not stop every possible outbound network request, including a deliberate model download. Apply an appropriate network policy if your requirements are stricter.
Docker does not impose CPU and memory ceilings by default. Before shared-host or production use, set and test suitable container resource limits while reserving capacity for the host. A low limit can cause a model load to fail; disabling the out-of-memory safeguard is not a capacity solution.
Use an SSH tunnel from your workstation:
ssh -N -o ExitOnForwardFailure=yes \
-L 127.0.0.1:11434:127.0.0.1:11434 youruser@your-vpsChoose a different local port if 11434 is already in use. This tunnel relies on an authorized SSH account and a properly secured server. It is not a public API endpoint for customer applications.
The first loopback address binds the listener on your workstation; the second is reached from the VPS. Keep the tunnel session open and verify the SSH host identity through your normal process. ExitOnForwardFailure detects failure to create the forwarding listener, not a later failure of Ollama itself. These options are documented in OpenSSH and ssh_config.
Docker port publishing documents a localhost-exposure issue in releases older than 28.0.0. Use a supported patched Engine and review non-default routing settings. Check the container port mapping and test the VPS public IPv4/IPv6 addresses from a separate authorized machine: port 11434 must not serve the API. Loopback protects the network boundary, not against administrators or other trusted processes on the host.
Download a model you have deliberately chosen
Pick an exact local-model tag from the official model catalog and read its model card, supported features and license. An embedding-only model is not a substitute for a text-generation model. Record the model identifier/digest as well as the tag so a future download can be compared with the evaluated artifact. The placeholder below is intentionally not a model recommendation:
export LOCAL_MODEL_TAG='REPLACE_WITH_APPROVED_LOCAL_MODEL_TAG'
docker exec ollama ollama pull "$LOCAL_MODEL_TAG"
docker exec ollama ollama listFrom the VPS, or your workstation with the tunnel active, substitute that same model tag in this request:
curl --fail-with-body http://127.0.0.1:11434/api/generate \
-H 'Content-Type: application/json' \
--data '{"model":"REPLACE_WITH_APPROVED_LOCAL_MODEL_TAG","prompt":"Return the word ready.","stream":false}'This follows the documented generate API. A successful answer establishes basic operation, not business-task accuracy or acceptable performance under load.
For a controlled context test, add options.num_ctx to the JSON request with the token budget chosen for that pilot, as described in the Ollama FAQ. Confirm the effective context in ollama ps before comparing results. Do not raise it to the model's advertised maximum simply because that maximum exists.
Measure context and waiting time
Use a representative set of short and long prompts. Record model identity, configuration, cold-start time, warm response time, peak memory and concurrent-request behavior. Keep the test data non-sensitive.
Ollama's context guidance explains that increasing context consumes more memory. Inspect the running model with:
docker exec ollama ollama ps
docker stats --no-stream ollamaThese are inspection examples, not results from a test we performed. Decide your acceptance limit before interpreting numbers: a background classifier and an interactive assistant can tolerate different delays.
Pilot check | Record | Decision it informs |
|---|---|---|
Cold versus warm request | Load time and complete response time for the same safe prompt | Whether unload/reload delays fit the task |
Longest representative input | Actual context, peak memory and task correctness | Whether context or model selection needs changing |
Expected busy period | Completed requests, waiting time, errors and CPU/GPU placement | Whether users can tolerate the queue |
Failure and restart | Behavior after a controlled restart; model availability | Whether the application retries safely and recovers |
The generate API returns timing and token-count fields. For a nonzero eval_duration, output generation rate can be calculated as eval_count / eval_duration × 1,000,000,000 because durations use nanoseconds. This excludes prompt processing, loading, network time and client-side waiting. Measure complete request latency separately; do not label generation speed as end-to-end throughput.
Repeat each representative case rather than relying on a single lucky request. Keep model, prompt set and context fixed while comparing hosts or quantizations. Decide quality, waiting-time and failure thresholds before the run, then retain the configuration and results privately. A response containing “ready” proves transport and basic generation, not correctness on invoices, code or customer support.
Add a gateway only when it is needed
For application use beyond an SSH tunnel, place a separately authenticated HTTPS gateway in front of the private backend. Design user authorization, request-size limits, concurrency limits, logs, budgets and abuse controls. Keep credentials out of browser code.
CORS configuration is not user authentication. A reverse proxy providing encryption does not by itself decide which users may invoke the model. Never expose the raw local endpoint simply because a client cannot connect through your intended gateway.
Troubleshoot without opening the backend
Symptom | First checks | Do not do this |
|---|---|---|
Works on the VPS, fails on the workstation | SSH destination, local port conflict, tunnel session and loopback request | Bind the raw API to all interfaces as a shortcut |
Model will not load or container exits | Image/model compatibility, free disk, memory limits and sanitized logs | Assume swap makes an oversized model production-ready |
One request works; concurrent use stalls | Queue length, effective context, loaded models and actual CPU/GPU placement | Raise parallelism without measuring memory again |
Expected local inference uses an external service | Local-model tag, local-only setting, application tools and outbound paths | Treat a localhost URL as proof that every downstream call stays local |
If the pilot exceeds its resource budget or exposes the API unexpectedly, stop the test and restore the previous known configuration before trying again. Keep the model volume and configuration until you know what must be retained; container replacement and data deletion are different operations. A production gateway needs a reviewed recovery and update path, not only a restart policy.
Back up application configuration and business data separately from the model cache. Record the exact model identifiers needed to rebuild, and account for download time during recovery. Map data flows before claiming that the system is private: local models, cloud models, web-search features and external tools are different paths.
Our AI-agent architecture guide explains when keeping inference outside the VPS may be simpler. Ask the hosting provider to confirm actual hardware instead of inferring it from the plan name.
Reader questions
Can a cheap CPU VPS run a large model?
Possibly, if resources and the model configuration fit, but usefulness depends on response time and concurrency. There is no tested large-model capacity claim in this guide.
Is a model's download size its RAM requirement?
No. Runtime memory includes additional working state and context. Measure the actual configuration instead of sizing from the download alone.
Can I expose port 11434 directly to the internet?
The local API does not require authentication. Keep it private and use a properly authenticated access layer when remote application access is required.
Was this guide helpful?
Help us make the next update better.
Sources & further reading
- Ollama Docker
- Ollama hardware support
- Ollama context length
- Ollama FAQ and local-only configuration
- Ollama API authentication
- Ollama generate API
- Docker port publishing
- Ollama model catalog
- llama.cpp quantization trade-offs
- Docker resource constraints
- OpenSSH forwarding options
- OpenSSH forwarding failure behavior
Originally published . About our editorial updates.



