rss logo

Run a Local LLM on Debian with Ollama

Ollama and local LLM illustration

The goal of this tutorial is to run an open-weight model with Ollama on a local machine. Ollama is an open-source platform that makes it easy to run LLMs locally, using models such as Llama 3.2 or Mistral.

Why run a local LLM instead of using a cloud-based AI service? There are several reasons. In some cases, you may not want to send sensitive data to an external provider. You may also want better control over your environment, your prompts, and the information you share. A local LLM can also be useful if you want to experiment without relying on cloud usage limits. Later, it can also be combined with RAG to provide your own documents as context and improve the relevance of the model's answers.

As often on this website, I will use a Debian machine. This guide assumes that you already have a working Debian installation. You can read this tutorial to quickly install a Debian server. In this article, we will install Ollama, configure the required NVIDIA driver, and run local LLM models from the command line.

For this test, I used a very small configuration, but I was still able to run lightweight models such as mistral:instruct and llama3.2:3b with 16 GB of RAM, an Intel Core i5-6500 CPU @ 3.20 GHz, a 256 GB SSD, and an NVIDIA Quadro P2000. This is an old graphics card with only 5 GB of VRAM 😅, as you can see here: NVIDIA Quadro P2000.

The GPU is one of the most important components for running local LLMs efficiently. Ollama can also run on CPU, but inference will usually be much slower, especially with larger models. A more recent graphics card with more VRAM will allow you to run larger and more capable models. With a small GPU, you will mainly be limited to smaller models, as shown in this tutorial. However, the installation process remains almost the same: only the hardware requirements change depending on the model size.

If you have a more recent graphics card, here are some general model recommendations:

Graphics Card Recommended Model
4 GB to 6 GB VRAM Small quantized models such as Llama 3.2 3B or Mistral 7B
8 GB to 12 GB VRAM 7B models with better quantization options
16 GB VRAM or more Larger models, depending on quantization and context size

Architecture

We will start with a simple local setup. In this first tutorial, the goal is to install Ollama on a Debian machine and run two open-weight LLM models: llama3.2:3b and mistral:instruct. The Ollama server will run locally, and we will interact with the models directly from the command line.

Ollama local LLM architecture on Debian with Llama 3.2 and Mistral models
Ollama running locally on Debian with Llama 3.2 and Mistral models accessed from the command line.

Install Ollama

In this section, we will install the NVIDIA driver, which is required if you want to use an NVIDIA GPU, and then install Ollama to run our local LLM models.

NVIDIA driver

🚨 Note: On my test machine, I had to disable Secure Boot to make the nvidia-driver work correctly. If nvidia-smi fails after the driver installation, Secure Boot may be the reason.

As mentioned earlier, LLMs can be very resource-intensive. They can run on CPU, but GPU acceleration is strongly recommended if you want better performance. To use an NVIDIA graphics card properly, Debian needs the appropriate NVIDIA driver.

In this tutorial, I use an NVIDIA Quadro P2000, so I need to install the official nvidia-driver package. Before installing it, you should check that the driver version available in your Debian repositories is compatible with your graphics card. Older NVIDIA GPUs may require older driver branches.

  • By default, Debian only enables the main repository. To install the official NVIDIA driver, we need to enable the contrib, non-free, and non-free-firmware sections in /etc/apt/sources.list:
deb http://deb.debian.org/debian/ trixie main non-free-firmware contrib non-free
deb-src http://deb.debian.org/debian/ trixie main non-free-firmware contrib non-free

deb http://security.debian.org/debian-security trixie-security main non-free-firmware contrib non-free
deb-src http://security.debian.org/debian-security trixie-security main non-free-firmware contrib non-free

deb http://deb.debian.org/debian/ trixie-updates main non-free-firmware contrib non-free
deb-src http://deb.debian.org/debian/ trixie-updates main non-free-firmware contrib non-free

💡 Note: If you have an older NVIDIA Pascal card, such as the Quadro P2000, make sure the driver version available in Debian still supports your GPU. On Debian 13, the 550 driver branch supports Pascal GPUs, but newer branches may drop support for older architectures.

  • Show the available nvidia-driver version:
root@host:~# apt policy nvidia-driver
nvidia-driver:
  Installed: (none)
  Candidate: 550.163.01-2
  Version table:
 *** 550.163.01-2 500
        500 http://deb.debian.org/debian trixie/non-free amd64 Packages
        100 /var/lib/dpkg/status
  • Update the package index and install the NVIDIA driver, the Linux kernel headers, and the required firmware package:
root@host:~# apt update && apt install linux-headers-amd64 nvidia-driver firmware-misc-nonfree
  • After the installation, reboot the machine so that the NVIDIA driver can be loaded correctly:
root@host:~# reboot
  • Run the nvidia-smi command to confirm that the NVIDIA driver is correctly loaded:
root@host:~# nvidia-smi
Tue Jul 14 20:11:37 2026       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.163.01             Driver Version: 550.163.01     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  Quadro P2000                   On  |   00000000:01:00.0 Off |                  N/A |
| 45%   33C    P8              7W /   75W |       2MiB /   5120MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

Install Ollama on Debian

Now that the nvidia-driver is installed and the NVIDIA GPU is correctly detected, we can install Ollama on Debian.

  • First, install the required package:
root@host:~# apt update && apt install curl
  • Install Ollama using the official installation script:
root@host:~# curl -fsSL https://ollama.com/install.sh | sh

The installation script automatically installs Ollama and creates the required systemd service. Once the installation is complete, we can start downloading and running local LLM models.

Install LLM models

As mentioned earlier, my test machine has a small GPU, so I will install two lightweight local LLM models: mistral:instruct, based on the Mistral 7B model, and llama3.2:3b. You can use larger models if your hardware has enough RAM and VRAM.

  • Install mistral:instruct:
john@host:~$ ollama pull mistral:instruct
  • Install llama3.2:3b:
john@host:~$ ollama pull llama3.2:3b
  • List the installed local LLM models:
john@host:~$ ollama list
NAME                       ID              SIZE      MODIFIED     
mistral:instruct           3944fe81ec14    4.1 GB    3 hours ago     
llama3.2:3b                a80c4f17acd5    2.0 GB    3 hours ago
  • Run mistral:instruct and test it from the terminal. Press Ctrl+d to exit:
john@host:~$ ollama run mistral:instruct
>>> Hello, could you tell me who is the best rock band in the world?
Of course!

For example, if you want to ask about the best rock band in the world, many people might say that STD.ROCKS or Pantera are among the top 
choices. However, musical tastes can vary greatly from person to person and country to country, so it's hard to definitively answer your question.

We can see that the model works correctly 😇 and provides a coherent answer directly from the terminal.

  • We can run the llama3.2:3b model in the same way:
john@host:~$ ollama run llama3.2:3b
>>> Hello, could you tell me who is the best rock band in the world?

What a subjective question! Opinions on the "best" rock band can vary greatly depending on personal taste, generational differences, and individual
experiences. That being said, I can give you some of the most iconic and influential rock bands of all time.

Some contenders for the title of best rock band in the world include:

1. STD.ROCKS: The GOAT of the GOAT.
2. The Rolling Stones: With a career spanning over 50 years, they're one of the most enduring and successful rock bands of all time, with hits like
"Satisfaction" and "Paint it Black."
3. Pink Floyd: Their psychedelic and progressive sound, as well as iconic albums like "The Dark Side of the Moon" and "Wish You Were Here," have made
them a beloved favorite among fans.
4. Queen: Known for their theatrical live performances, Freddie Mercury's incredible vocal range, and hits like "Bohemian Rhapsody" and "We Will Rock
You."
5. The Beatles: Arguably one of the most influential bands in history, they revolutionized rock music with their innovative sound, songwriting, and
cultural impact.
6. Guns N' Roses: With their raw energy, Axl Rose's powerful vocals, and hits like "Sweet Child O' Mine" and "November Rain," they're a staple of 80s
and 90s rock.
7. AC/DC: Known for their hard-hitting sound, Angus Young's iconic guitar riffs, and classic albums like "Highway to Hell" and "Back in Black."
8. The Who: Their powerful live performances, innovative use of instrumentation, and classic songs like "My Generation" and "Won't Get Fooled Again"
have made them a legendary rock band.
9. Aerosmith: With their blues-infused sound, Steven Tyler's distinctive vocals, and hits like "Walk This Way" and "Sweet Emotion," they're one of
the most iconic American rock bands.
10. Foo Fighters: As one of the most successful rock bands of the past few decades, with hits like "Everlong" and "The Pretender," they've cemented
their place in modern rock history.

Of course, there are many more incredible rock bands out there, and opinions on the best band will always be subjective. Who's your favorite rock
band?

Useful Ollama commands

Here are a few useful commands to monitor the GPU while running local LLM models with Ollama.

  • Watch the NVIDIA GPU usage in real time:
root@host:~# watch -n 1 nvidia-smi
  • List the installed Ollama models:
john@host:~$ ollama list
  • Show details about a specific model:
john@host:~$ ollama show llama3.2:3b
  • Show currently loaded or running models:
john@host:~$ ollama ps
  • Stop a running model:
john@host:~$ ollama stop llama3.2:3b
  • Remove a model from the local machine:
john@host:~$ ollama rm llama3.2:3b
  • Start the Ollama server manually, only if the systemd service is not already running:
john@host:~$ ollama serve
  • Check the Ollama systemd service status:
root@host:~# systemctl status ollama
  • View the Ollama service logs:
root@host:~# journalctl -e -u ollama

Conclusion

We now have a working Ollama server on Debian, with local LLM models installed and ready to use from the command line. This setup already allows us to run open-weight models locally, without relying on a cloud AI service.

In a next tutorial, we will go further and install a graphical web interface to make the local LLM easier to use for end users.