Ollama on DigitalOcean Droplet — Complete Setup Guide

Run Ollama on DigitalOcean Droplet

We earn commissions when you shop through the links on this page, at no extra cost to you.

Updated March 2026


Running Ollama on a DigitalOcean Droplet gives you a private AI server in the cloud. You get full control, no usage limits, and no data sent to third parties. This guide walks you through the complete setup — from creating a Droplet to running your first model.


What You’ll Need

  • A DigitalOcean account — sign up here
  • Basic knowledge of SSH and Linux commands
  • About 15 minutes

Ollama on DigitalOcean Droplet — Which Size Do You Need?

Ollama loads the model into RAM. If the Droplet doesn’t have enough memory, the model won’t run. Choose your size based on which model you want to use.

Droplet SizeRAMSuitable ModelsMonthly Cost
Basic — 2 vCPU2GBPhi-3 Mini, TinyLlama~$12/month
Basic — 2 vCPU4GBMistral 7B, Llama 3 8B~$24/month
Basic — 4 vCPU8GBLarger models, multiple users~$48/month
CPU-Optimized16GB+Llama 3 70B, Qwen 72B$96+/month

Start with the 4GB Droplet at $24/month. It handles Mistral 7B and Llama 3 8B without issues.

💡 These are CPU-only Droplets. DigitalOcean also offers GPU Droplets (NVIDIA H100) for larger models and faster inference.


Step 1 — Create Your Droplet

  1. Log in to your DigitalOcean account
  2. Click CreateDroplets
  3. Select a region close to you
  4. Choose Ubuntu 22.04 LTS as the image
  5. Select your Droplet size
  6. Set up SSH key authentication
  7. Click Create Droplet

Your Droplet will be ready in about 60 seconds with a public IP address assigned.


Option A — 1-Click Marketplace Setup

DigitalOcean has an official Ollama + Open WebUI app in their Marketplace. Ollama and the web interface are pre-installed automatically. No command line needed.

  1. Go to the DigitalOcean Marketplace — Ollama with Open WebUI
  2. Click Create Ollama with Open WebUI Droplet
  3. Select your Droplet size (4GB RAM minimum)
  4. Click Create Droplet

Once running, open http://YOUR_DROPLET_IP in your browser. You can download and run models directly from the UI.

Use this option if you want a ChatGPT-style interface without touching the terminal.


Option B — How to Run Ollama on a DigitalOcean Droplet Manually

Use this option if you want full control over your setup.

Step 2 — Connect via SSH

ssh root@YOUR_DROPLET_IP

Replace YOUR_DROPLET_IP with the IP shown in your DigitalOcean dashboard.


Step 3 — Install Ollama

Run the install script:

curl -fsSL https://ollama.com/install.sh | sh

Ollama installs and starts as a background service. Verify the installation:

ollama --version


Step 4 — Pull and Run a Model

For 4GB RAM — Mistral 7B:

ollama pull mistral
ollama run mistral

For 4GB RAM — Llama 3 8B:

ollama pull llama3
ollama run llama3

For 2GB RAM — Phi-3 Mini:

ollama pull phi3
ollama run phi3

After the model loads, you will see an interactive prompt. Type your message and press Enter.

To exit:

/bye


Step 5 — Enable External API Access

By default Ollama only listens on localhost. To access it from outside the Droplet, update the service config:

sudo systemctl edit ollama

Add this:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

Save and restart:

sudo systemctl restart ollama

Test from another machine:

curl http://YOUR_DROPLET_IP:11434/api/generate \
  -d '{"model": "mistral", "prompt": "Explain Kubernetes in simple terms"}'

⚠️ Opening port 11434 publicly exposes your API. Restrict access to trusted IPs using the DigitalOcean firewall.


Step 6 — Configure the Firewall

  1. Go to NetworkingFirewalls in your DigitalOcean dashboard
  2. Click Create Firewall
  3. Add an Inbound Rule: TCP, Port 11434, your IP only
  4. Apply the firewall to your Droplet

Managing Ollama as a Service

# Check status
sudo systemctl status ollama

# Restart
sudo systemctl restart ollama

# Stop
sudo systemctl stop ollama

# View logs
journalctl -u ollama -f


Useful Ollama Commands

# List downloaded models
ollama list

# Pull a new model
ollama pull <model-name>

# Remove a model
ollama rm <model-name>

# Show model info
ollama show mistral


Best Models to Run Ollama on DigitalOcean Droplet

ModelSizeBest For
Mistral 7B~4GBGeneral tasks, fast responses
Llama 3 8B~5GBReasoning, coding, Q&A
Phi-3 Mini~2GBLow-resource, fast inference
Llama 3 70B~40GBMaximum capability, needs 48GB+ RAM
Qwen 2.5 Coder~5GBCode generation and review

Cost Comparison — DigitalOcean vs OpenAI API

UsageOpenAI API (GPT-4o)DigitalOcean Droplet (Mistral)
Light — 50k tokens/day~$15/month$24/month fixed
Medium — 200k tokens/day~$60/month$24/month fixed
Heavy — 1M tokens/day~$300/month$24/month fixed

At medium to heavy usage, the Droplet costs less than the API. You also keep full control of your data.


Troubleshooting

IssueFix
Model won’t loadNot enough RAM — upgrade Droplet or use smaller model
Cannot connect to APICheck OLLAMA_HOST setting and firewall rules
Slow responsesExpected on CPU — upgrade to GPU Droplet for speed
SSH connection refusedCheck SSH key and Droplet IP in dashboard
Ollama not runningRun sudo systemctl restart ollama

Next Steps

  • Add Open WebUI for a browser-based chat interface
  • Integrate with n8n for AI-powered automation workflows
  • Connect to VS Code via the Continue extension
  • Build a RAG pipeline using LangChain and your own documents

Why Run Ollama on DigitalOcean?

Running Ollama on a DigitalOcean Droplet gives you a dedicated server with full API access and complete control over your models. No per-token costs, no data leaving your infrastructure. Get started with DigitalOcean →


You Might Also Like

Leave a Reply