Skip to content

VPS & dedicated

Run Ollama on a VPS without melting the box

Match model size to free memory, bind Ollama to localhost, and keep the API off the public internet.

Updated Aug 29, 20263 min read18 reads
Run Ollama on a VPS without melting the box
Match the model to free RAM before you pull anything.

Running Ollama on a VPS without melting the box means sizing the model to free RAM and binding the API to localhost. Ollama serves large language models on a machine you control, so you need root and enough memory for the weights. A LogicWeb VPS is KVM with full root access, which is what this stack requires. Shared hosting cannot load Ollama because you have no root and CloudLinux limits will stop a multi-gigabyte model cold.

Check free memory before you pull

Log in over SSH and run free -h so you can see what is already in use. Subtract MariaDB, web services, and anything else that must stay healthy on this guest. A 7B model at Q4 quantization often needs about five to eight gigabytes of resident RAM once it is warm. If you only have two gigabytes free, resize the VPS or choose a smaller model instead of forcing the pull. Do not rely on swap for an LLM, because heavy swapping saturates disk I/O and makes every site on the server look down.

Stock VPS plans run CPU inference only, with no GPU attached. CPU inference works for modest models, though it is slower than a card would be. If you truly need a GPU, that conversation belongs on a dedicated server with the right chassis, not a compose flag on a small VPS.

Install Ollama, pull, and confirm the bind

bash
curl -fsSL https://ollama.com/install.sh | sh
ollama pull llama3.2
ollama run llama3.2

The official install script places a systemd unit on Linux. After it finishes, confirm the service with systemctl status ollama so you know the daemon is up. By default Ollama listens on 127.0.0.1:11434, which is the safe bind for a public VPS. If you set OLLAMA_HOST to 0.0.0.0:11434 so a laptop can reach it, you expose an unauthenticated model API to the internet. Put a reverse proxy and authentication in front of that port, or keep the service local.

Call Ollama from your apps, not from the open internet

WordPress plugins and other tools that add AI features will call whatever URL you give them, including port 11434. Keep that URL on localhost or on a private hostname that only your guest can resolve. If the model can reach tools or a shell, treat prompt logs seriously, because a model with shell access behaves like an unvetted junior admin.

  1. Enable and start the service with systemctl enable –now ollama.
  2. Run ollama list and confirm the model you pulled is present.
  3. Test with curl http://127.0.0.1:11434/api/tags from the same guest.
  4. Only then point your application or plugin at the local endpoint.

n8n on the same VPS can call Ollama over localhost once both services are stable. Stack them after the first model pull finishes, not while weights are still downloading. Our guide to n8n on a VPS covers that sibling install.

Pick a model that fits free RAM, snapshot the guest, install Ollama, and leave port 11434 off the public internet. That is the practical path to running Ollama on a VPS without melting the box.

Share

Send this article

Need someone else to do this? Send them the link — the commands are in the article.

Was this article helpful?

Be the first to rate this article.