DeepSeek-R1 is a powerful open-source large language model (LLM) designed for advanced reasoning and problem-solving. This guide shows you how to install and run DeepSeek-R1 locally on your Ubuntu system using Ollama, a streamlined framework for managing and running LLMs. This provides a compelling alternative to cloud-based solutions like OpenAI’s models, offering greater control, privacy, and potentially lower costs.
Why Run DeepSeek-R1 Locally on Ubuntu?
Running LLMs like DeepSeek-R1 locally on your Ubuntu machine offers several advantages:
- Privacy: Keep your data and prompts on your own system.
- Cost-Effectiveness: Avoid recurring cloud computing costs.
- Offline Access: Use the model even without an internet connection.
- Customization: Fine-tune and experiment with the model on your own hardware.
Prerequisites:
- A running Ubuntu system (desktop or server).
- Internet connection (for initial download).
- Sufficient disk space (depending on the model size).
- Ollama installed. Follow our guide: Setting Up Ollama on Ubuntu: A Beginner’s Guide
DeepSeek-R1 Model Sizes and Storage Requirements:
DeepSeek-R1 comes in various sizes, each with different performance characteristics and storage needs:
deepseek-r1:1.5b
: 1.1 GB (Good for testing and resource-constrained systems)deepseek-r1:7b
: 4.7 GBdeepseek-r1:8b
: 4.9 GBdeepseek-r1:14b
: 9 GB (Recommended for a balance of performance and resource usage)deepseek-r1:32b
: 19 GB (Use with caution; requires significant RAM)deepseek-r1:70b
: 42 GB (Requires substantial disk space and powerful hardware)deepseek-r1:671b
: 404 GB (Not practical for most personal computers)
Installation Steps:
1. Open a Terminal: Use Ctrl+Alt+T or search for “Terminal” in your applications.
2. Install DeepSeek-R1: Use the ollama run
command followed by the desired model name.
For example, to install the 14b version:
ollama run deepseek-r1:14b
Replace 14b
with the desired size (e.g., 1.5b
, 7b
, etc.).
3. Wait for Download and Setup: Ollama will download the model files and set everything up. This may take some time depending on your internet connection and the model size.
4. Interact with DeepSeek-R1: Once the installation is complete, you can start interacting with the model directly in the terminal.
Optimizing Performance on Ubuntu:
- Swap Space: If you have limited RAM, configure swap space to prevent out-of-memory errors.
- Hardware Considerations: A dedicated GPU can significantly accelerate performance.
- Model Selection: Choose a smaller model if you have limited resources.
Troubleshooting:
- Out of Memory Errors: Try using a smaller model or increasing your swap space.
- Network Issues: Check your internet connection
Conclusion:
Installing DeepSeek-R1 on Ubuntu with Ollama provides a powerful local AI solution. By following these steps, you can harness the capabilities of this advanced LLM directly on your machine. Remember to choose a model size appropriate for your hardware and explore the possibilities of local AI development.