Deploy DeepSeek-R1 on VPS, a powerful reasoning-based Large Language Model (LLM), on a VPS allows you to leverage its AI capabilities remotely and efficiently. Unlike traditional LLMs, DeepSeek-R1 is designed for complex reasoning tasks in coding, mathematics, and science. This guide covers how to install and run DeepSeek-R1 on your VPS, ensuring an optimized, scalable, and secure deployment.
A VPS offers dedicated resources, making it an ideal environment for running AI models without relying on local hardware. Here’s why you should consider setting up DeepSeek-R1 on a VPS:
Before installing DeepSeek-R1, ensure your VPS meets the following minimum requirements:
To begin, connect to your VPS using SSH. Open a terminal and run:
ssh user@your-vps-ip
Replace user with your VPS username and your-vps-ip with your server’s IP address.
Before proceeding with installation, update your system to the latest packages:
sudo apt update && sudo apt upgrade -y
This ensures a stable and secure software environment.
Ollama is a tool that simplifies the deployment of LLMs like DeepSeek-R1. To install Ollama, run the following command:

curl -fsSL https://ollama.com/install.sh | sh
After installation, verify by running:
ollama

If installed correctly, the command will display the Ollama version and options.
Once Ollama is installed, download the DeepSeek-R1 model:
ollama pull deepseek-r1:14b
This command downloads the 14-billion-parameter version of DeepSeek-R1. Depending on your VPS specifications, you can choose a smaller or larger model.
After downloading, you can run the model by executing:
ollama run deepseek-r1:14b
This starts the DeepSeek-R1 model, allowing you to interact with it directly.
For programmatic interaction, use Python to communicate with DeepSeek-R1. First, install the Ollama Python library:
pip install ollama
Create a Python script, deepseek_chat.py, and add the following code:
import ollama
desired_model = 'deepseek-r1:14b'
question = 'What is the capital of France?'
response = ollama.chat(model=desired_model, messages=[
{'role': 'user', 'content': question},
])
print(response['message']['content'])
Run the script:
python deepseek_chat.py
This sends a question to DeepSeek-R1 and returns the AI-generated response.
To keep DeepSeek-R1 running persistently, use screen or tmux.
screen -S deepseek_session
ollama run deepseek-r1:14b
Press Ctrl + A, then D to detach the session. To reconnect, use:
screen -r deepseek_session
tmux new -s deepseek_session
ollama run deepseek-r1:14b
Detach using Ctrl + B, then D. To reconnect, use:
tmux attach -t deepseek_session
To prevent unauthorized access, enable a firewall:
sudo ufw allow ssh
sudo ufw allow 5000/tcp
sudo ufw enable
Monitor resource usage using:
top
gpu-smi (if GPU is available)
Deploying DeepSeek-R1 on a VPS allows for efficient remote AI processing. By following these steps, you can install, configure, and run DeepSeek-R1 securely on your VPS. Whether for machine learning applications, research, or business, this setup ensures scalability and optimal performance.
For more advanced configurations, consider integrating Docker, optimizing for GPU acceleration, and implementing an API for remote access.By following this guide, you now have DeepSeek-R1 up and running on your VPS, ready for AI-driven applications!