Skip to main content

Guides

Run Local AI on Linux with Ollama

Install Ollama on Linux, check that its service answers, then run a downloaded tag. Use ollama ps to see whether the model loaded on your CPU, GPU or both.

By Updated 12 min read

Start with native Ollama and one small model. For Windows and Mac, read How to Install and Update Ollama on Windows, Mac and Linux. This is a practical first path for a Linux user who can open a terminal and wants local chat or a connection other apps can use. Docker, a browser workspace, and a coding agent can wait until that first conversation works.

These steps use Ollama's Linux terminal interface on an x86-64 or ARM64 machine with systemd, the service manager used by many common distributions. Ollama's desktop chat app is offered for Windows and macOS; the Linux installation has no desktop controls.

For a graphical desktop app, follow Install LM Studio on Linux. If you prefer Ollama and your distribution does not use systemd, use Ollama's manual installation and startup instructions instead of the service commands below.

Check the computer first

Note your system RAM, available disk space, CPU architecture, and exact graphics card. Download the build intended for your architecture; an x86-64 program is not the native ARM64 build.

In a Linux terminal, these commands show the architecture, system memory, and free space in your home directory:

uname -m
free -h
df -h "$HOME"

x86_64 means the amd64 download; aarch64 means ARM64. The standard service stores models under /usr/share/ollama/.ollama/models, so also check the filesystem containing /usr/share/ollama after installation with df -h /usr/share/ollama. Free space in your home directory does not count.

A supported GPU helps; CPU execution also works. Start with what your computer can run if you do not know its memory or graphics limits. Download size leaves out conversation memory, temporary calculations, and memory for the operating system.

Install the model runner

Arch Linux package

On Arch Linux, the official extra repository lists a package named ollama for x86_64. Install it with pacman:

sudo pacman -S ollama

The same repository lists ollama-cuda, ollama-rocm and ollama-vulkan builds. Their descriptions say CUDA, ROCm and Vulkan. Read each package page before choosing one, and follow the package's own instructions for service setup.

Official install script

Choose one installation path. If your package manager already manages Ollama, install or update it through that same package manager and skip the upstream installer below. Continue at Check the installation. Do not overwrite package-owned files with the upstream installer.

For an upstream installation, the current Linux installer needs curl to download files and zstd to extract its compressed package. On Debian or Ubuntu, install those prerequisites in a Linux terminal:

sudo apt-get update
sudo apt-get install curl zstd

On Fedora, use sudo dnf install curl zstd instead. On Ubuntu, the install command below is the one Ollama documents for Linux. On an up-to-date Arch Linux installation, use sudo pacman -S --needed curl zstd for these prerequisites. For another distribution, install the same packages through its package manager. You need internet access and permission to install system software. If you chose the upstream path, run Ollama's installation command:

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

Run it in a Linux terminal, not PowerShell. It downloads and runs an installation script from Ollama. You can read the script before executing it; the Linux download page identifies the official installer. The installer requests permission to change system files and configure a service. If it reports another missing utility, install the named package before retrying; do not treat that error as an installed app.

Check the installation

After either installation path, open a new terminal and run:

ollama --version
systemctl status ollama --no-pager

The first command should print a version. The second should show the service running. If it is installed but stopped, use sudo systemctl start ollama, then check its status again. To start Ollama at boot, run sudo systemctl enable ollama. To read its logs, run journalctl -e -u ollama. For a deliberate manual installation, start ollama serve in a separate terminal instead. Do not start a second server when a service is already using the port.

For a manual Linux installation, use the official architecture-specific ollama-linux-amd64.tar.zst or ollama-linux-arm64.tar.zst archive and the separately supplied ROCm package when applicable. Follow the Linux installation documentation for extraction and service paths.

Download the exact model

This exercise uses Qwen's Qwen3-1.7B text model through Ollama's qwen3:1.7b tag. The current Ollama download contains Q4_K_M compressed weights, with a model download of about 1.4 GB. Ollama manages the GGUF weights and accompanying template; you do not need to import a separate Hugging Face file. The weight details identify the compression. The model uses the Apache 2.0 license linked from its model card; check those terms before redistribution.

ollama pull qwen3:1.7b
ollama list

Wait for the download to finish and confirm that qwen3:1.7b appears in the list. Avoid a tag ending in :cloud for this local exercise. To inspect the download, run ollama show qwen3:1.7b; it reports the model's details, including its parameter size, compression (quantization) level and context length, as Ollama's show-model reference describes. Then start the downloaded model:

ollama run qwen3:1.7b

Set context and check a useful answer

At Ollama's interactive prompt, enter this command before sending your text:

/set parameter num_ctx 4096

On an 8 GB CPU-only computer, enter /set parameter num_ctx 2048 instead. On the 8 GiB example, start at 2,048 tokens; the 8 GB guide shows the memory budget; 2,048 tokens leaves the most room.

For larger-memory computers, the command above selects a 4,096-token context for this conversation: instructions, chat, and the answer share that allowance. This setting is for this interactive session; enter it again after reopening.

At the same prompt, ask "Return only the number: crate 17." Check for 17.

A correct answer shows the selected tag generated text from your prompt. Keep the terminal open and run ollama ps in a second one. Check CONTEXT and PROCESSOR there.

Check whether the GPU is actually used

After the answer, keep the chat open and run ollama ps in a second terminal. Check the qwen3:1.7b row: CONTEXT should show the setting you chose (2048 for the 8 GB CPU-only experiment, 4096 otherwise), and PROCESSOR distinguishes CPU, GPU, and a split between them. No row means it is not currently loaded; send another short message and check promptly. A large amount of RAM or a working nvidia-smi command does not by itself show that the model uses the GPU.

For NVIDIA, nvidia-smi can establish that the driver sees the card. For AMD, compare the exact card and driver with Ollama's hardware documentation. Vulkan can support additional AMD and Intel GPUs on Linux, but the appropriate Linux Vulkan driver must be installed. Backend and operating-system support matter independently of graphics memory. Follow GPU troubleshooting if a supported GPU is not used. CPU-only execution is a processor choice, not proof of insufficient memory or a failed answer.

Exit, unload, and reopen

Enter /bye at the chat prompt to return to your shell. Exiting the conversation can leave the model loaded temporarily. To release that model's memory deliberately, run:

ollama stop qwen3:1.7b
ollama ps
ollama list

The running-model list should no longer contain this model, while the downloaded-model list should still contain it. stop unloads it; it does not delete the download. Reopen with ollama run qwen3:1.7b, set num_ctx to the same 2048 or 4096 value again, and send the same prompt in the new conversation. Loading may take time even when no download is needed. Reopening the model does not restore your previous chat. To build a customized model later, write a Modelfile and use ollama create, described in the command-line reference.

The Ollama service can remain running with no model loaded. If you want to stop the service too, use sudo systemctl stop ollama; restart it with sudo systemctl start ollama before your next chat. For a manually started ollama serve, press Ctrl+C in its own terminal instead.

If the first run fails

SymptomFirst useful action
ollama is not foundReopen the terminal and use the command-not-found guide
The command cannot reach the serviceCheck systemctl status ollama; read journalctl -u ollama --no-pager -n 100 for the failure
The download failsCheck disk space and connection using the download guide
The model loads but runs slowlyCheck ollama ps for CPU execution and the actual context; close other loaded models and keep this first task short
Loading reports insufficient memoryUnload other models with ollama stop NAME; retry this short context, or use memory troubleshooting to choose a smaller download
The answer is not 17Treat the exercise as failed; retry the same prompt in a fresh chat before trying a different model.

Do not delete the model library or reinstall graphics drivers because one model is too large.

Update Ollama on Linux

Check the installed version with ollama --version. If the service is not running, the command can report a connection warning. Record the models listed by ollama list and the storage path before changing the installation.

Ollama 0.40.18 (November 24) updates its bundled llama.cpp build to b12651, which removes JetPack 5 support. On a Jetson, check the installed JetPack version before updating. Release notes.

  • If you installed with Ollama's official script, Ollama documents rerunning that script: curl -fsSL https://ollama.com/install.sh | sh. Stop any separately started server first.
  • If you installed the Arch package, update with the package manager instead of installing a second copy over it. Use sudo pacman -Syu for the normal full system upgrade; review the proposed package changes, including your installed Ollama GPU package.
  • For a manual archive installation, follow the manual upgrade instructions with the current .tar.zst archive for the same installation prefix and CPU architecture. Do not remove libraries belonging to a package-managed installation by hand.

After updating, start or restart the service you actually use, check ollama --version and ollama list, then open the same short local model and repeat the first-chat exercise above.

Remove a downloaded model without uninstalling Ollama

Use the exact name and tag from ollama list. For example, to remove the model used in this guide:

ollama stop qwen3:1.7b
ollama rm qwen3:1.7b
ollama list

If the model is already stopped, proceed to the removal after confirming the correct tag. The last command should no longer show that tag. Removing a model deletes the installed model entry; other models can share weight files, so the freed disk space need not equal the displayed model size. To use it again, download the tag with ollama pull qwen3:1.7b. Keep any custom Modelfile or original weights needed to recreate a customized model.

Uninstall Ollama on Linux

Decide first whether you want to stop running Ollama, remove the program while keeping downloads, or delete the program and its data. Only the last option calls for deleting your model files.

  1. If you use a systemd service, inspect it with systemctl cat ollama. Record the account, executable, environment overrides and any OLLAMA_MODELS location. A service normally stores downloads under its own account, not your interactive shell's home directory. If you run ollama serve manually, stop that process in its terminal instead.
  2. Back up any custom models, Modelfiles, settings or other data you want to keep. For a service, the usual Linux model directory is /usr/share/ollama/.ollama/models; a user-run instance may use ~/.ollama/models. Check the actual configured path, particularly if you moved model storage.
  3. If a systemd service was installed, stop it and disable startup with sudo systemctl disable --now ollama.
  4. Remove the program using its original installation method, as described below.
  5. Check command -v ollama and the status of the service. If another installation is still found, identify it rather than deleting every matching file.

If installed with the Arch package manager

Use pacman -Q to identify installed Ollama packages (including a CUDA, ROCm or Vulkan package, where present), then sudo pacman -R ollama if Ollama is the only package to remove. If the package manager identifies a dependent Ollama GPU package, review the exact removal list and remove the installed Ollama packages together. Do not bypass dependency checks or remove unrelated GPU drivers. The pacman manual explains package removal. Check for remaining custom service overrides and data separately.

If installed with the official script or manually

Follow Ollama's Linux uninstall instructions. For a manually created or script-installed service, remove its own unit file after confirming its location in systemctl cat ollama, and reload systemd with sudo systemctl daemon-reload. Confirm the Ollama executable path with command -v ollama before removing that executable and the matching Ollama-only library directory from the installation prefix. On a default installation those locations may be under /usr/local/bin and /usr/local/lib, or under /usr/bin and /usr/lib for a manual archive installation. Do not delete a whole bin or lib directory. If package ownership is uncertain, identify it first.

Keep or remove the downloads

Keep the model storage directory and its permissions if you expect to reinstall. To delete all Ollama data, inspect the confirmed model and configuration paths and remove only Ollama's own files after backing up anything you need. Remove a dedicated service account or its home directory only after checking that it is not used for other work. Removing Ollama does not remove data held by a separate app such as Open WebUI.

To reinstall, use the original installation method, restore the model directory configuration if you changed it, and check the service, version and model list before attempting to reuse a download.

Continue from the working chat

Try offline use before using the setup away from the internet. Add Open WebUI if you want a browser workspace, or follow CPU-only guidance if this machine has no usable GPU.

Sources