Run DeepSeek Locally on Linux: A Quick Guide

DeepSeek, established in 2023 by Liang Wenfeng, is a Chinese AI company specializing in open-source large language models (LLMs). Their prominent model, DeepSeek-R1, is gaining recognition for its sophisticated reasoning abilities, rivaling OpenAI-o1 in areas like mathematics, coding, and general logic. This guide provides instructions to install DeepSeek-R1 on a Linux system, including key information about the available model variants.

Prerequisites

Note: DeepSeek-R1 is a 671B model that uses a Mixture of Experts (MoE) architecture that requires 1.5 TB of VRAM, which may not be practical for use on consumer hardware. DeepSeek-R1 distilled models, such as DeepSeek-R1-Distill-Qwen-7B and DeepSeek-R1-Distill-LLaMA-70B, are fine-tuned versions of open-source models such as LLaMA and Qwen, trained on data generated by DeepSeek-R1. As a result, they inherit DeepSeek’s reasoning capabilities while being much more efficient to self-host.

Before proceeding, ensure that you meet the following requirements:

  • Operating System: Ubuntu 22.04 or a similar Linux distribution (Debian/Debian-based is recommended).
  • Hardware: Modern CPU with at least 16 GB of RAM and a dedicated GPU (NVIDIA GPUs are recommended).
  • Software: Python 3.8 or later, and Git installed on your system.
  • Free disk space: At least 10 GB for smaller models; larger models like 671b require significantly more.

Installing DeepSeek R1

The easiest way to get DeepSeek R1 up and running is by installing Ollama.

Step 1: Install Ollama.

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

Step 2: Verify the installation.

ollama --version

Step 3: Check if Ollama is already running.

systemctl is-active ollama.service

Step 4: If the output is active, skip to the next step. If not, start the service manually.

sudo systemctl start ollama.service

Step 5: To automatically start the service when your system boots, run.

sudo systemctl enable ollama.service

Step 6: Download and run the 7b model, use the command.

ollama run deepseek-r1:7b

Step 7: To launch DeepSeek again, simply repeat the run command.

Downloading and Running DeepSeek-R1 Manually

DeepSeek-R1 includes various distilled models fine-tuned from Qwen and Llama architectures, each optimized for specific performance and resource requirements. Here’s how to get started:

To download and run the 7b model, use the command:

ollama run deepseek-r1:7b

If your system has limited resources (like mine, 16 GB RAM and only 8 GB AMD GPU), you can choose a smaller model:

  • 1.5b: Minimal resource usage.
  • 7b: Balanced performance and resource requirements.
  • 8b, 14b, 32b: Intermediate options for higher performance.

The download size for these models varies:

  • 1.5b: ~2.3GB
  • 7b: ~4.7GB
  • 70b: ~40GB+

Visit the DeepSeek Model Library for a complete list of models, their sizes, and details.

Prompting DeepSeek

Once the installation command completes, it also automatically runs DeepSeek R1, meaning there’s nothing left to configure—your setup is complete. You’ve successfully installed DeepSeek on Linux! Go ahead and enter your first prompt.

Any time you would like to launch DeepSeek again, simply repeat the run command.

Listing and Removing Models

To view all models downloaded, run the following command:

ollama list

To remove an installed model and free up disk space, use the following command:

ollama rm deepseek-r1:70b

Replace 70b with the appropriate model size, such as 7b or 8b. This will delete the specified model from your system. Once removed, you can proceed to download and run a different model. If you are looking for DeepSeek-R1 with no censorship or content restrictions, you can use open-r1.


This guide walked you through installing DeepSeek-R1 on your Linux system, enabling you to explore its diverse models and harness its advanced reasoning capabilities locally. Start experimenting with DeepSeek today!