Setting up and running DeepSeek-R1 on various computing resources

This post provides a way of setting up a prompting environment to run DeepSeek-R1 on various computing resources, be it a computer or server node or cluster. DeepSeek-R1 has demonstrated competitive performance and has attracted attention recently. Given that DeepSeek-R1 is publicly available, this post explains how to set it up and use it on computers or clusters.
The system requirements to run different versions of DeepSeek-R1 vary, yet that’s another topic, since the focus of the post is on installation and configuration. For a discussion about system requirements, see for example this post.
The present post focuses on installing the involved software on Linux from the command line without root access. The reason for this choise is to ensure that the setup is available both on Linux computers and on computer clusters, where typically root access is not available.
Ollama
In this post, Ollama is used for downloading and running DeepSeek-R1. First, the Ollama source code is
downloaded under ~/opt/ollama
, and then a soft link to the ollama
binary is created in ~/bin
. Assuming that ~/bin
is
in the user’s PATH
environment variable, it suffices to source ~/.bashrc
for the ollama
binary to be accessible from
the command line.
mkdir -p ~/opt/ollama
curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz
tar -C ~/opt/ollama -xzf ollama-linux-amd64.tgz
mkdir ~/bin
ln -s ~/opt/ollama/bin/ollama ~/bin
source ~/.bashrc
Typically, to run Ollama, its server can be started as follows:
ollama serve
However, it is possible that the default port is already occupied, in which case the Ollama server fails to start; I have
experienced this issue on a remote computer node. This GitHub issue explains
how to circumvent the problem by changing the port via the OLLAMA_HOST
environment variable. Indeed, setting the port to
11435, instead of the default 11434, as shown below, solved the issue for me:
OLLAMA_HOST=127.0.0.1:11435 ollama serve
Having started the Ollama server, it can be checked whether it runs by starting a new terminal and running the following command, which prints the Ollama version:
ollama -v
If the Ollama server runs on a computer node or cluster, rather than a personal computer, then a second terminal can be
started by running the screen
shell command or by pressing F2 if tmux is used for terminal management. If tmux is used,
then byobu-enable
needs to be run first to turn on tmux.
At the moment of writing, there is no direct control over the choice of GPU or CPU nodes. Ollama uses all the GPU resources it autodetects; see this GitHub issue.
DeepSeek from the shell
Subject to the available system resources a version of DeepSeek-R1 is chosen. For demonstration purposes, the smallest deepseek-r1:1.5b version is pulled and run using the command below:
ollama run deepseek-r1:1.5b
Alternative quantized, distilled or full versions of DeepSeek-R1 include deepseek-r1:8b, deepseek-r1:14b, deepseek-r1:32b and deepseek-r1:70b.
The last command starts DeepSeek-R1 prompt. To terminate the prompt, the user can either type /bye
on the prompt or press
Ctrl+d.
DeepSeek from the Chatbox
Instead of interacting with DeepSeek-R1 from the shell, it is possible to do so from Chatbox. To install Chatbox from the command line, the following commands can be run:
mkdir -p ~/opt/chatbox
wget -P ~/opt/chatbox https://github.com/Bin-Huang/chatbox/releases/download/v0.10.4/Chatbox.CE-0.10.4-x86_64.AppImage
chmod u+x ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.AppImage
echo '\#!/bin/bash' > ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.sh
echo '~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.AppImage --no-sandbox' >> ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.sh
chmod u+x ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.sh
ln -s ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.sh ~/bin/chatbox
source ~/.bashrc
Having executed the above commands, Chatbox can be started by typing chatbox
on the command line. It is noted that the Bash
script ~/opt/chatbox/Chatbox.CE-0.10.4-x86_64.sh
was set up in order to be able to call Chatbox with the --no-sandbox
option, thus avoiding the error message below, which I encountered:
The SUID sandbox helper binary was found, but is not configured correctly
After starting Chatbox, the model can be configured by clicking on Settings and by setting the following entries:
- Model Provider: OLLAMA.
- API Host: http://127.0.0.1:11434, http://127.0.0.1:11435 or any other combination of localhost and port used to start Ollama.
- Model: deepseek-r1:1.5b or any other pulled model present in the dropdown menu.
Apart from Ollama and Chatbox, the DeepSeek API can be integrated with other popular software. See this GitHub repository for alternative DeepSeek integrations.