How to run a DeepSeek AI chatbot with Ollama on your VPS
DeepSeek has taken the AI world by storm with impressive language models that match or outperform many commercial alternatives and are entirely open source. With Ollama, you can run DeepSeek directly on your own VPS or server without sending data to third-party APIs. This guide shows you exactly how, step by step.
Why run DeepSeek locally?
There are several good reasons to run AI models such as DeepSeek on your own server rather than using cloud-based APIs:
- Data protection: Your data never leaves your server, which matters for GDPR compliance and confidential business information
- No API costs: Avoid ongoing API expenses with heavy usage
- Full control: Adapt the model and its behaviour exactly as you wish
- Offline capability: The model runs without an internet connection
- No rate limits: Run as many requests as you need
What is Ollama?
Ollama is an open-source tool that makes it easy to run large language models (LLMs) locally. It handles downloading, installing and running models such as DeepSeek, Llama, Mistral and many others. Ollama offers a simple command-line interface and a REST API that you can integrate into your applications.
System requirements
The requirements depend on which DeepSeek model you want to run. Here is an overview:
| Model | RAM required | Storage | Recommended use |
|---|---|---|---|
| DeepSeek-R1:1.5b | 4 GB | ~1 GB | Testing and development |
| DeepSeek-R1:7b | 8 GB | ~4 GB | Light production use |
| DeepSeek-R1:14b | 16 GB | ~8 GB | Balanced performance |
| DeepSeek-R1:32b | 32 GB | ~20 GB | High quality |
| DeepSeek-R1:70b | 64 GB+ | ~40 GB | Maximum quality |
For most purposes, we recommend starting with DeepSeek-R1:7b on a VPS with 8–16 GB RAM. This offers a good balance between performance and resource usage.
Step 1: Prepare your Linux VPS
Start by updating your system and making sure the required packages are installed:
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget gitStep 2: Install Ollama
Ollama can be installed with a single command:
curl -fsSL https://ollama.com/install.sh | shThe installation script automatically sets up Ollama as a system service that starts at boot. Verify the installation:
ollama --versionStep 3: Download the DeepSeek model
You can now download the DeepSeek model. Here, we use the 7b version:
ollama pull deepseek-r1:7bThe download may take a while depending on your connection speed. The model is stored locally and only needs to be downloaded once.
Step 4: Test the model
Once the download finishes, you can test the model immediately in the terminal:
ollama run deepseek-r1:7bYou will now see an interactive prompt where you can ask the model questions directly. Enter /bye to exit.
Step 5: Use the REST API
Ollama automatically exposes a REST API on port 11434. You can use it to integrate DeepSeek into your applications:
curl http://localhost:11434/api/generate -d '{ "model": "deepseek-r1:7b", "prompt": "Forklar hvad en VPS er på dansk", "stream": false
}'Step 6: Enable external API access (optional)
By default, Ollama listens only on localhost. To access the API from other machines, you need to change its configuration:
# Rediger Ollama's systemd service
sudo systemctl edit ollama.service # Tilføj disse linjer under [Service]:
[Service]
Environment="OLLAMA_HOST=0.0.0.0" # Genstart tjenesten
sudo systemctl restart ollamaImportant: If you enable external API access, protect it with a firewall and, where appropriate, a reverse proxy with authentication.
Step 7: Set up Open WebUI (optional)
For a user-friendly chat interface, install Open WebUI to get a ChatGPT-like interface for your local models:
# Installer Docker hvis du ikke allerede har det
curl -fsSL https://get.docker.com | sh # Kør Open WebUI
docker run -d -p 3000:8080 \ --add-host=host.docker.internal:host-gateway \ -v open-webui:/app/backend/data \ --name open-webui \ --restart always \ ghcr.io/open-webui/open-webui:mainNow open your browser and go to http://din-server-ip:3000 to access the web interface.
Optimisation and tips
Here are some useful tips for optimising your DeepSeek setup:
- Use a GPU if available: Ollama automatically supports NVIDIA and AMD GPUs, providing significantly faster inference
- Adjust context length: Shorter contexts use less RAM and provide faster responses
- Run multiple models: Ollama can handle multiple models simultaneously, which is useful for comparing results
- Automatic startup: The Ollama service starts automatically when the server restarts
Conclusion
Running DeepSeek with Ollama on your own VPS is surprisingly easy and gives you full control over your AI models and data. With a GITC VPS equipped with sufficient RAM and NVMe SSD storage, you can have your own AI chatbot running in under 30 minutes.
Need more power for demanding AI workloads? GITC also offers GPU hosting for businesses that want to run larger models at maximum performance. Contact us to learn more about our GPU solutions.