Back to Blog

How to Install Ollama: Run AI Models on Your Own Server

How to install Ollama and run AI models on your own server: setup, choosing a model and RAM, using the API, Open WebUI, secure access and CPU usage.

Nodesty Team5 min readServers
The word Ollama with LLM, API and Open WebUI on a dark Nodesty background

Ollama is an open-source tool that lets you download and run open AI models such as Llama, Qwen, Gemma and Mistral on your own computer or server with a single command. Once it's installed, you can talk to models from the command line, connect them to your applications through an API, or use them from the browser with an interface such as Open WebUI. Your data never leaves your server, and you don't pay per request.

This guide covers installing Ollama on a Linux server, choosing the right model and RAM, using the API, a web interface with Open WebUI, secure access and what to watch out for with CPU usage. The guide is based on running models on the CPU on a server without a graphics card.

Installing Ollama

After connecting to your server over SSH, run Ollama's official install script:

curl -fsSL https://ollama.com/install.sh | sh

The script installs Ollama and starts it as a systemd service. Check its status:

systemctl status ollama
ollama --version

By default, Ollama only listens on 127.0.0.1:11434; this is a safe default.

Running your first model

To download a model and start a chat:

ollama run llama3.2

On the first run, the model is downloaded; after that you can talk to the model on the command line. Type /bye to exit. Commonly used commands:

CommandWhat does it do?
ollama pull modelDownloads a model
ollama run modelRuns the model and starts a chat
ollama listLists downloaded models
ollama psShows the models loaded in memory
ollama rm modelDeletes a model

You can see the available models and their sizes in the model library on Ollama's website.

Choosing a model and RAM

When running on the CPU, the model is loaded into the server's RAM. Roughly, you need as much RAM as the model's file size, plus a few GB of headroom:

Model size (4-bit compressed)Approximate RAM neededUse on the CPU
1–3 billion parameters2–4 GBFast; good for simple tasks
7–8 billion parameters6–8 GBUsable speed, good quality
12–14 billion parameters10–16 GBSlows down; takes patience
30 billion and above20 GB and aboveUsually very slow on the CPU
  • Quantization: Compressed versions of models, such as 4-bit ones, use much less RAM and run faster; the loss in quality is small for most uses.
  • Speed: On the CPU, response speed depends on the core count, memory speed and model size. Start with a small model and scale up as you need.
  • License: Each model has its own license; check it before commercial use.

Using the API

Ollama offers an HTTP API so your applications can connect to the model:

curl http://127.0.0.1:11434/api/generate -d '{
  "model": "llama3.2",
  "prompt": "Why should I back up my server?",
  "stream": false
}'

For chat-style requests, the /api/chat endpoint is used. Ollama also offers an OpenAI-compatible API (/v1/chat/completions); you can connect your applications that use OpenAI client libraries to Ollama by changing the address.

A web interface with Open WebUI

To use models from the browser with a chat interface, you can install the open-source Open WebUI with Docker:

docker run -d -p 127.0.0.1:3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui:/app/backend/data \
  --name open-webui --restart always \
  ghcr.io/open-webui/open-webui:main

Because the port is bound only to 127.0.0.1, the interface isn't exposed to the internet. We cover installing Docker and port security in our Docker installation guide.

Secure access

Ollama's API has no authentication. If you open port 11434 to the internet, anyone who finds it can use your server's resources. Instead:

  • SSH tunnel: Access the API or Open WebUI securely from your own computer:
    ssh -L 3000:127.0.0.1:3000 -L 11434:127.0.0.1:11434 user@203.0.113.10
    

    Then open http://127.0.0.1:3000 in your browser. The details are in our What is an SSH tunnel? article.
  • Reverse proxy: If you're going to open Open WebUI to your team on a domain name, put Nginx and SSL in front of it and use Open WebUI's own user accounts. The details are in our Nginx installation guide.

If you need to change the address Ollama listens on, you can set the OLLAMA_HOST environment variable in the systemd service; but if you set the address to 0.0.0.0, open the port in the firewall only to addresses you trust.

CPU usage and performance

While a model generates a response, it uses all of the processor's cores heavily. For an assistant that a few people use now and then this isn't a problem, but constant, heavy use is a different matter:

  • Limit concurrent requests. Many requests at the same time slow down every request.
  • Don't keep models in memory longer than needed. Ollama unloads unused models from memory after a while; this time is configurable.
  • Monitor resource usage. We cover tracking CPU and memory usage in our Server monitoring guide.

On virtual servers, CPU usage is subject to the provider's fair use rules. For AI workloads that need high CPU usage all day without a break, a dedicated server whose hardware is reserved entirely for you is a better fit.

Ollama at Nodesty

Nodesty AMD EPYC 7763 VPS plans, with their high-RAM options, let you comfortably keep 7–8 billion parameter models in memory. On virtual servers, average CPU usage has to be kept below 75% under our Fair Use Policy; if you're going to run the model heavily all day, choose our dedicated servers, where you can use the whole processor at 100% capacity 24/7.

Frequently Asked Questions

Can I run Ollama without a graphics card?

Yes. If there's no graphics card, Ollama runs models on the CPU. Small, compressed (quantized) models respond at a usable speed on a powerful processor. Large models run slowly on the CPU; hardware with a graphics card is a better fit for them.

How much RAM does each model need?

Roughly, you need as much RAM as the model's file size, plus a few GB of headroom. Small models with 1–3 billion parameters run with a few GB, and 4-bit compressed models with 7–8 billion parameters run with about 6–8 GB. Larger models need tens of GB of RAM.

What's the advantage of running a model on my own server?

Your data never leaves your server, you don't pay per request, and you can choose and tune the model however you like. In return, response speed and quality may fall behind large cloud models, and the hardware and maintenance are your responsibility.

Should I expose the Ollama API to the internet?

No. Ollama's API has no authentication; anyone who finds an open API can use your server's resources. Leave the API on 127.0.0.1 only and access it through an SSH tunnel or from behind a reverse proxy with authentication.

Can I use the models in commercial projects?

That depends on each model's own license. Some models are free for commercial use, while others include restrictions or extra conditions. Read a model's license before using it in your product.

Why are the model's responses slow?

For models running on the CPU, speed depends on the core count, memory speed and the size of the model. Choosing a smaller or more heavily compressed model, shortening the context length and limiting the number of requests running at the same time all speed up responses.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································