# Run your first model on Linux

> One install command, one pull command, then you are chatting in the terminal. Check your GPU driver first if you have a graphics card.

This takes about ten minutes, most of it waiting for a download. You need a 64-bit Linux install with `curl`, sudo rights and about 10 GB of free disk space.

## Step 1: Check your memory

Paste this into a terminal:

```bash
free -h
nvidia-smi --query-gpu=name,memory.total --format=csv
```

The **Mem** row of the first command is your system memory. The second prints your NVIDIA card's name and memory in MiB, if you have one. Divide by 1024 for GB.

If you have an NVIDIA card, use its memory to find your row. If you do not, use system memory. It decides which model you download in step 3.

| Your memory | Model class | Suggested model | Download |
| --- | --- | --- | --- |
| 8 GB | Small, up to about 4B | Qwen3 4B | about 2.5 GB |
| 16 GB | Small, up to about 8B | Qwen3 8B | about 5 GB |
| 24 GB and up | Mid, about 20B | gpt-oss-20b | about 13 GB |

Without a graphics card, start with the 8 GB row whatever your memory. On a CPU, smaller runs faster.

## Step 2: Install one app

Install **[Ollama](https://localagi.co/ollama)** with its official script from [ollama.com](https://ollama.com/download/linux):

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

The script downloads Ollama, sets it up as a background service and detects NVIDIA or AMD graphics. It asks for your sudo password. Ollama is free and open source, and it runs entirely from the terminal.

Check it worked:

```bash
ollama --version
```

If you would rather have a window with a chat box, LM Studio ships a Linux AppImage at [lmstudio.ai](https://lmstudio.ai). Once it is open, steps 3 and 4 match the [Windows page](https://localagi.co/quick-start-windows-nvidia).

## Step 3: Download the suggested model

Pull the model for your row. Ollama names its builds with a colon and a size tag:

```bash
ollama pull qwen3:4b      # 8 GB row
ollama pull qwen3:8b      # 16 GB row
ollama pull gpt-oss:20b   # 24 GB and up
```

Run only the line for your row. Ollama's default builds are 4-bit, the same as the table.

The download is the slow part. The table shows the size and a rough time on a 100 Mbit/s connection. After this, everything runs offline.

**The catch.** 
A model bigger than your VRAM still runs. Ollama splits it between the card and system memory, and the part on the CPU runs many times slower. Stay in your row until you have seen what full speed feels like.

## Step 4: Say hello

Start a chat with the model you pulled, for example:

```bash
ollama run qwen3:8b
```

At the `>>>` prompt, paste this and press Enter:

**Try it.** 

```text
In two sentences, explain what a token is. Then write a four-line poem about a laptop that thinks.
```

A good response starts within a few seconds and streams in word by word. It explains tokens as pieces of words, then gives you a short poem. The wording will differ every time you ask.

Type `/bye` to leave.

Qwen3 is a [reasoning model](https://localagi.co/reasoning-models), so it may show its thinking before the answer. That is normal.

If text is appearing, you are running AI on your own machine. Nothing you typed left the computer.

## What just happened

You downloaded a [model](https://localagi.co/what-is-a-model), which is one large file of numbers. Ollama is a [runtime](https://localagi.co/the-stack), the software that loads the model and does the maths on your GPU or CPU. The model wrote its answer one [token](https://localagi.co/tokens) at a time, and the speed you saw is how fast your memory can feed it.

## If it did not work

**Ollama says it could not connect, or asks if it is running.** The background service is not up. Start it with `sudo systemctl start ollama`, then try again. `systemctl status ollama` shows why it stopped.

**Answers are slow on a machine with a graphics card.** Ollama is running on the CPU. Check the driver as in the notes below, then run `ollama ps` while a model is loaded, and the processor column should say GPU. More fixes in [Why is my GPU not being used?](https://localagi.co/gpu-not-used).

**The pull fails or stops.** Check free space with `df -h ~`. Then run the same `ollama pull` line again. It resumes where it stopped.

Anything else is in [Troubleshooting and reference](https://localagi.co/troubleshooting).

## Linux notes

The install is one line. Everything else depends on your GPU driver, so check it before you blame Ollama.

For NVIDIA, install the proprietary driver from your distribution's own tool, such as **Additional Drivers** on Ubuntu. Then run:

```bash
nvidia-smi
```

If it prints a table naming your card and a driver version, you are fine. If the command is missing or reports it cannot talk to the driver, Ollama will fall back to the CPU. [Which NVIDIA card should I get?](https://localagi.co/nvidia-gpus) covers card choice.

For AMD, Ollama uses ROCm, which supports a specific list of cards. Check yours against Ollama's GPU docs before you expect it to be used. [Do AMD and Intel work for local AI?](https://localagi.co/amd-and-intel) has the details.

**Rule of thumb.** 
On a graphics card, VRAM is your budget. Without one, system memory is the budget and speed is the limit.

## Go deeper

### Seeing your speed

Add `--verbose` to the run command and Ollama prints timing after every answer:

```bash
ollama run qwen3:8b --verbose
```

The **eval rate** line is how fast it wrote, in tokens per second. Compare it with the speeds in [How fast is fast?](https://localagi.co/how-fast-is-fast).

### Where Ollama keeps things

The install script creates an `ollama` system service and a user for it. Models pulled by the service live in that user's data directory, not your home folder. `ollama list` shows what you have and how big each one is, and `ollama rm` followed by a name deletes one.

### Talking to it from code

The service also listens on port 11434 for programs on your machine. Any tool that speaks the OpenAI API can use it. [How do I call a local model from code?](https://localagi.co/local-api) shows how, and [How do I use Ollama?](https://localagi.co/ollama) covers the rest of the commands.
