EN · $ USD
Developer and Application Servers

Running a Local LLM on a Server With Ollama: Requirements

7 min read Updated: Sunucu Atlas technical team

In short

Ollama installs on an Ubuntu server with a single command and runs on the CPU without a GPU. RAM is the deciding resource: as a guideline, a 4-bit quantized 3B model needs 4 GB, a 7-8B model 8 GB, a 14B model 16 GB and a 32B model 32 GB of RAM. Speed depends on memory bandwidth and core count. The API listens on 127.0.0.1:11434 by default and should only be exposed through a key-protected HTTPS proxy.

In this guide
  1. What is Ollama?
  2. RAM and CPU requirements by model size
  3. What determines CPU-only inference performance?
  4. Installing Ollama (Ubuntu)
  5. Service settings
  6. Using the API
  7. Exposing the API safely
  8. Adding a web interface
  9. Which server should you choose?

Installing Ollama on a Linux server takes a single command, and it runs without a graphics card, using only the CPU. The real decision is the hardware: RAM determines which models you can run, while memory bandwidth and core count determine how fast you get answers. As a guideline, 8 GB of RAM is enough for a 4-bit quantized model with 7-8 billion parameters. In this article we cover installation, a resource table by model size, what drives CPU-only performance and how to expose the API to the internet safely.

What is Ollama?

Ollama is an open-source tool that makes it easy to download and run open-weight large language models (LLMs) on a local server. It downloads models such as Llama, Qwen, Gemma and Mistral with a single command, keeps them in memory and serves them over an HTTP API. Under the hood, it uses an inference engine based on llama.cpp.

You need to know two concepts to size your server:

  • Parameter count: The size of the model; "8B" means 8 billion parameters. A larger model usually gives better answers but needs more memory and compute.
  • Quantization: Storing model weights with fewer bits. Most models in Ollama come quantized to around 4 bits by default (e.g. Q4_K_M); this shrinks the model to roughly a quarter of its full-precision size, and the quality loss is limited for most uses.

RAM and CPU requirements by model size

The table below is a rough guide for 4-bit quantized models; exact values vary by model family and context length. A simple rule: RAM needed ≈ model file size + context memory + 1-2 GB for the operating system.

Model classExample modelsApprox. model sizeRecommended RAMRecommended vCPUs
1-4BLlama 3.2 3B, Qwen2.5 3B2-3 GB4 GB2-4
7-8BLlama 3.1 8B, Qwen2.5 7B, Mistral 7B4.5-5 GB8 GB4+
12-14BGemma 3 12B, Qwen2.5 14B8-9 GB16 GB6-8
27-32BGemma 3 27B, Qwen2.5 32B17-20 GB32 GB10+
70BLlama 3.3 70B40-43 GB48-64 GB12-16

As the context window grows, the KV cache grows too, and the same model needs more RAM. If you plan to summarize long documents, leave headroom above the values in the table. Loading several models at once also adds up memory.

Model files are stored under /usr/share/ollama/.ollama/models by default. If you plan to try several models, account for disk space too; an NVMe disk shortens the time it takes to load a large model into memory for the first time.

What determines CPU-only inference performance?

CPU inference has two phases, and they depend on different resources:

  • Prompt processing: Reading the input text is compute-heavy; core count and vector instruction sets such as AVX-512 are what matter.
  • Token generation: Producing the answer token by token is limited by memory bandwidth; for each token, most of the model weights are read from memory. That is why DDR5 memory and a smaller model directly increase speed.

Practical takeaways:

  1. A smaller model makes a big difference. 3-8B models respond at a usable speed on a CPU for chat, classification, summarization and n8n automations. Models of 32B and up are slow on a CPU and suit batch jobs that can tolerate waiting.
  2. Concurrent users are limited. A server without a GPU is not for a chat service that handles many users at once; it is for personal assistants, internal tools and background jobs.
  3. Run your own benchmark. The ollama run llama3.2:3b --verbose command shows tokens per second (eval rate) after each answer. Try different models with the same question and pick the one that fits your needs.

We explain in detail how the Zen 5 architecture and DDR5 memory of the AMD Ryzen 9 9950X help with this workload in Ryzen 9 9950X server: what DDR5 and Zen 5 bring.

Installing Ollama (Ubuntu)

  1. Update the system and install Ollama with the official script:
    sudo apt update && sudo apt upgrade -y
    curl -fsSL https://ollama.com/install.sh | sh
  2. Verify that the service is running:
    systemctl status ollama
    ollama --version
  3. Download a model and try it:
    ollama pull llama3.2:3b
    ollama run llama3.2:3b "Merhaba, kendini kısaca tanıt."
  4. See installed models and models loaded in memory:
    ollama list
    ollama ps

The install script sets up Ollama as a systemd service running as the ollama user; it starts automatically when the server reboots.

Service settings

You configure Ollama with environment variables. Add the following to the file that opens with sudo systemctl edit ollama:

[Service]
Environment="OLLAMA_KEEP_ALIVE=30m"
Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_NUM_PARALLEL=2"
sudo systemctl daemon-reload
sudo systemctl restart ollama
  • OLLAMA_KEEP_ALIVE: How long a model stays in memory after the last request. If you keep it short, the model reloads every time and the first answer is delayed.
  • OLLAMA_MAX_LOADED_MODELS: The number of models kept in memory at once. Keep it at 1 on servers with limited RAM.
  • OLLAMA_NUM_PARALLEL: The number of requests a model processes at the same time. Each parallel request needs extra context memory.
  • OLLAMA_MODELS: If you want to move models to a different disk, set the folder path with this variable.

Using the API

By default, Ollama listens only on 127.0.0.1:11434. From inside the server, you can send a request like this:

curl http://127.0.0.1:11434/api/generate -d '{
  "model": "llama3.2:3b",
  "prompt": "Hosting nedir? Tek cümleyle açıkla.",
  "stream": false
}'

Ollama also offers an OpenAI-compatible endpoint at /v1/chat/completions. This lets you connect apps that use an OpenAI client library, n8n or other tools to your local model just by changing the base URL. For the n8n side of the setup, see the setting up an AI agent in n8n guide.

Exposing the API safely

The Ollama API has no built-in authentication. If you set OLLAMA_HOST=0.0.0.0 and open the port to the internet, anyone who finds the address can use your model, eat up your server's CPU, and download or delete models. The safe options are:

  1. SSH tunnel (single user): Run ssh -L 11434:127.0.0.1:11434 kullanici@sunucu-ip from your own computer; you reach the API locally at http://127.0.0.1:11434, and no port is opened on the server.
  2. IP restriction: If only one specific app server needs access, open port 11434 in the firewall to that IP only. However, this requires binding Ollama to 0.0.0.0, and traffic travels unencrypted.
  3. Nginx + HTTPS + API key (recommended): Ollama stays on 127.0.0.1, Nginx terminates HTTPS and forwards only requests that carry the correct key.

For the third method, first point a subdomain (e.g. llm.ornek.com) to the server, create a server block for that domain in Nginx and get a certificate with certbot --nginx -d llm.ornek.com. Then generate a random key:

openssl rand -hex 32

Edit the location / section in the 443 server block that Certbot created as follows:

location / {
    if ($http_authorization != "Bearer BURAYA_URETTIGINIZ_ANAHTAR") {
        return 401;
    }
    proxy_pass http://127.0.0.1:11434;
    proxy_set_header Host localhost:11434;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_read_timeout 600s;
}

proxy_buffering off makes streaming responses go through immediately, and a long proxy_read_timeout keeps the connection from dropping on slow responses from large models. OpenAI-compatible clients already send the key in the Authorization: Bearer header, so no extra setup is needed. Finally, make sure only ports 22, 80 and 443 are open in the firewall; for basic hardening, follow the first 10 security steps on a new Ubuntu server.

Adding a web interface

If you want to chat from the browser, you can install an open-source interface such as Open WebUI with Docker and connect it to Ollama. That interface provides its own user login; keep the Ollama API itself closed to the outside.

Which server should you choose?

For CPU-only inference, the three things that help most are plenty of RAM, fast memory and strong cores. Sunucu Atlas AMD Ryzen 9 9950X VDS plans come with DDR5 RAM, NVMe disks, KVM virtualization and root access, which makes them a natural fit for this workload. A rough match:

If you want to run a small model as a container next to a web app and manage everything from a panel, AI Hosting with the Coolify panel preinstalled is another option; the SA-AI-3 plan with 12 GB of RAM can carry a 3-8B class model alongside your app. If you get stuck during setup, you can open a support ticket.

Frequently asked questions

Does Ollama work without a GPU?

Yes. If Ollama cannot find a GPU, it runs the model on the CPU and system RAM. It is slower than a GPU, but 3-8B class models respond at a usable speed on a CPU for personal use and automations.

How much RAM does an 8B model need?

As a guideline, a 4-bit quantized 7-8B model takes up about 4.5-5 GB; with the operating system and context memory, a server with 8 GB of RAM is enough. If you will use a long context, leave more headroom.

What port does Ollama use?

By default, Ollama listens on port 11434 and only on 127.0.0.1. You can change the address and port with the OLLAMA_HOST environment variable.

Can I password-protect the Ollama API?

Ollama has no authentication of its own. Leave the API on 127.0.0.1 and put an Nginx reverse proxy with HTTPS in front of it to add a Bearer key or password check.

Can I use OpenAI API-compatible apps with Ollama?

Yes. Ollama offers an OpenAI-compatible endpoint at /v1/chat/completions. Just point the base URL in your app to your Ollama server and change the model name.

Where are model files stored?

When installed as a systemd service on Linux, models are stored under /usr/share/ollama/.ollama/models by default. You can set a different folder with the OLLAMA_MODELS variable.

For this guide

Recommended plans

Since RAM and memory speed decide how well an LLM runs without a GPU, Ryzen 9 9950X VDS, with up to 64 GB of DDR5 RAM, has a plan that fits whichever model size you choose.

SA-R9-9950X-1

RYZEN9 9950X
Recommended

2 GB DDR5 RAM

$7.86/mo

+VAT

  • Processor2 vCPU
  • ModelAMD Ryzen 9 9950X
  • Disk40 GB NVMe
  • LocationIstanbul
  • Port: 1G Port
  • Traffic: Fair use
  • Virtualization: KVM
  • Multi-layer DDoS protection

SA-R9-9950X-2

RYZEN9 9950X

4 GB DDR5 RAM

$11.01/mo

+VAT

  • Processor2 vCPU
  • ModelAMD Ryzen 9 9950X
  • Disk50 GB NVMe
  • LocationIstanbul
  • Port: 1G Port
  • Traffic: Fair use
  • Virtualization: KVM
  • Multi-layer DDoS protection

SA-R9-9950X-3

RYZEN9 9950X

6 GB DDR5 RAM

$15.73/mo

+VAT

  • Processor4 vCPU
  • ModelAMD Ryzen 9 9950X
  • Disk60 GB NVMe
  • LocationIstanbul
  • Port: 1G Port
  • Traffic: Fair use
  • Virtualization: KVM
  • Multi-layer DDoS protection

Ryzen 9 9950X VDS — tüm paketler AI Hosting — tüm paketler

Need help with setup?

Send questions about your service in a support ticket, and our technical team will walk you through it step by step.