
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.
Why Run DeepSeek-R1 on a VPS?
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:
- Scalability: Easily upgrade RAM, storage, or CPU as needed.
- Remote Access: Run AI models from anywhere with internet access.
- Reduced Hardware Requirements: No need for an expensive local GPU setup.
- Performance & Stability: VPS servers are optimized for high-load tasks.
Prerequisites
Before installing DeepSeek-R1, ensure your VPS meets the following minimum requirements:
- Operating System: Ubuntu 20.04+ (recommended) or Debian-based Linux distribution.
- CPU: Multi-core processor (Intel i9 or AMD Ryzen recommended).
- RAM: At least 16GB RAM (higher for larger models).
- Storage: Minimum 40GB SSD (DeepSeek-R1 models require significant disk space).
- GPU (Optional): NVIDIA GPU with CUDA support for faster processing.
- Python 3.8+ installed
- Ollama Installed (for easy model deployment)
Step 1: Setting Up Your VPS
Connect to Your VPS
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.
Update & Upgrade System Packages
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.
Step 2: Install Ollama
Download Ollama
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
Selecting the Correct Version
After installation, verify by running:
ollama
If installed correctly, the command will display the Ollama version and options.
Step 3: Download & Install DeepSeek-R1 Model
Installing Ollama Setup
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.
Running the Installer
Step 4: Running DeepSeek-R1 on Your VPS
Installation Progress
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.
Verifying Installation
Step 5: Creating a Python Script to Use DeepSeek-R1
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.
Running DeepSeek-R1 from Command Line
Step 6: Running DeepSeek-R1 as a Background Service
To keep DeepSeek-R1 running persistently, use screen or tmux.
Using screen
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
Using tmux
tmux new -s deepseek_session
ollama run deepseek-r1:14b
Detach using Ctrl + B, then D. To reconnect, use:
tmux attach -t deepseek_session
Step 7: Securing & Optimizing DeepSeek-R1 on VPS
Selecting the DeepSeek-R1 Model
Enable Firewall
To prevent unauthorized access, enable a firewall:
sudo ufw allow ssh
sudo ufw allow 5000/tcp
sudo ufw enable
Monitor Performance
Monitor resource usage using:
top
gpu-smi (if GPU is available)
Choosing Model Parameters
Conclusion
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!