Skip to content

How to Deploy Grafana on a VPS

Updated Sep 2026

We earn commissions when you shop through the links below. Full disclosure →

Self-host Grafana on your own VPS — the standard open-source dashboarding layer for metrics, logs, and traces, querying Prometheus, Loki, InfluxDB, and dozens of other data sources.

Before you start
  • A VPS with 1+ GB RAM
  • A metrics or logs data source (e.g. Prometheus) — or use Grafana's built-in SQL sources
  • A fresh Ubuntu 24.04 or 26.04 server with root/sudo SSH access
Need a box for this guide? Kamatera's free tier lets you spin one up now.Start free on Kamatera → (opens in new tab)

What Grafana is

Grafana is the standard open-source dashboarding layer for metrics, logs, and traces. It doesn't collect data itself — it connects: Prometheus for metrics, Loki for logs, InfluxDB, Postgres, and dozens of other sources plug in as data sources, and Grafana turns them into unified dashboards and alerting in one pane of glass.

The appeal of self-hosting it is control and breadth: no per-user SaaS seat costs, your queries and dashboards live on your own box, and one Grafana instance can visualize everything from server health to application business metrics. It's a Go backend with a TypeScript frontend, rated 2 / 5 to deploy, and comfortable on 1 GB of RAM — a light, reliable service that runs on a modest VPS for years.

Server sizing — Grafana is light, the data sources aren't

Grafana itself needs surprisingly little. It stores dashboards and users in an embedded database and spends most of its time serving queries over the network.

Standalone sizing:

  • 1 GB RAM — plenty for dashboards, users, and alerting on a small setup
  • 2 GB RAM — if you're running many concurrent dashboard users or large queries against heavy data sources

Running data sources on the same box: add the backends on top. A Prometheus server wants another 1–2 GB, Loki similar, so a combined observability VPS is happier at 2–4 GB total. A 2 vCPU / 4 GB VPS runs Grafana plus Prometheus and Loki comfortably.

Prepare the server

Start from a fresh Ubuntu 24.04 or 26.04 server. Update and create a non-root user:

apt update && apt upgrade -y
adduser deploy
usermod -aG sudo deploy

Lock down the firewall:

ufw allow OpenSSH
ufw allow 80
ufw allow 443
ufw enable

Install Docker:

curl -fsSL https://get.docker.com | sh
usermod -aG docker deploy

Log out and back in as deploy so the docker group takes effect.

Where to host itaffiliate disclosure
Hetzner Cloudrun it on
2 vCPU · 4 GB RAM · 80 GB SSD · $23.59/mo
Get Hetzner Cloud (opens in new tab)
Kamaterafree trial
1 vCPU · 1 GB RAM · 20 GB SSD · $4.00/mo
Start free on Kamatera → (opens in new tab)
DigitalOceanalso works on
1 vCPU · 1 GB RAM · 25 GB SSD · $6.00/mo
Deploy on DigitalOcean → (opens in new tab)

Paid link — we earn a commission if you shop through it.

Install Grafana

Create a working directory:

mkdir ~/grafana && cd ~/grafana

Create a compose file:

services:
  grafana:
    image: grafana/grafana-oss:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:3000:3000"
    volumes:
      - grafana_data:/var/lib/grafana

volumes:
  grafana_data:

The 127.0.0.1 bind keeps Grafana private — a reverse proxy handles public access, which also protects you from an open, default-admin dashboard on the open internet.

Start it:

docker compose up -d

Grafana listens on port 3000.

Connect a data source

Grafana is only as useful as the data behind it. Add a first source via Connections → Data sources → Add data source. The classic pairing is Prometheus; if you don't have one yet, the quick container version in its own directory:

mkdir ~/prometheus && cd ~/prometheus
cat > compose.yaml <<EOF
services:
  prometheus:
    image: prom/prometheus:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:9090:9090"
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus_data:/prometheus
volumes:
  prometheus_data:
EOF

Then reload Prometheus from your host as needed (or keep it static with a few scrape targets in prometheus.yml), start it, and add it as a data source in Grafana at http://127.0.0.1:9090. Grafana queries the data source over the Docker network or host network, so the URL must resolve from Grafana's container — on the same server, http://host.docker.internal:9090 is the reliable pick.

HTTPS + domain

Grafana carries login credentials and, increasingly, alerts — it needs HTTPS in production. Point a reverse proxy at 127.0.0.1:3000 and terminate TLS on 443.

The simplest path is Automatic HTTPS with Caddy. Point an A record for your hostname (say monitor.example.com) at the server's public IP, then have Caddy reverse-proxy that hostname to 127.0.0.1:3000.

If you use the Caddy container approach, put Grafana and Caddy in the same compose file and proxy to the Grafana service name:

reverse_proxy grafana:3000

First login and hardening

Load https://monitor.example.com. On a fresh install, the default credentials are admin / admin — Grafana forces a password change on first login.

Change it immediately. An unauthenticated Grafana is a read of all your metrics and, with alerting enabled, a foothold. After that:

  1. Set the admin email under Administration → Users → Main admin, so password resets reach you.
  2. Create a data source and a first dashboard to confirm the chain works.
  3. Turn off anonymous access unless you want public dashboards (Configuration → Users → Anonymous).

Backups

The important data — dashboards, users, and data-source configs — lives in the Grafana volume:

docker run --rm -v grafana_data:/data -v $(pwd):/backup alpine \
  tar czf /backup/grafana-$(date +%F).tar.gz -C /data .

This backs up everything you've configured. Restore it to a fresh Grafana instance and your dashboards come back. For an even simpler safety net, use a provider's daily snapshot or backup add-on, if your plan offers one — but note snapshots restore the whole box, not just Grafana.

Upgrades

Pull the newer image and recreate:

docker compose pull
docker compose up -d

Grafana runs migrations automatically on startup. Check the Grafana releases page before a major version bump, since plugin and dashboard schema changes occasionally need attention.

Troubleshooting

Dashboard loads but no data. The data source isn't reachable from the Grafana container. Verify the URL resolves from inside the container — on the same host, prefer http://host.docker.internal:PORT over 127.0.0.1, which would point at the container itself.

Can't log in / forgotten admin password. Grafana resets the admin password from the GF_SECURITY_ADMIN_PASSWORD environment variable on startup; set it in the compose file, recreate the container, log in, then change it in the UI.

Alerts not firing. Check that alerting is enabled for the data source and that the alert's evaluation interval is set. Test with a query you know returns data.

Page loads slowly. Usually a heavy query against a remote data source. Add Grafana's caching or point it at a closer/leaner backend before sizing up the VPS.

Verification + next steps

You're done when you can: load the dashboard over HTTPS, log in with a strong password, add a data source, build a dashboard that shows live data, and create an alert. You're ready to use it as the one window over your whole fleet.

From here, add Loki for logs, Prometheus node_exporter agents on your other servers, or the Netdata agent — Grafana vs Netdata explains how the two fit together. For a monitoring-first VPS, see Best VPS for Monitoring & Uptime for the ranked picks.

Next steps

How to self-host Grafana →More self-hosted observability tools →Automatic HTTPS with Caddy →Run Claude Code with Ollama on Your Own VPS →Deploy Coolify on a VPS →How to Deploy Actual Budget on a VPS →How to Deploy AnythingLLM on a VPS →How to Deploy Appwrite on a VPS →How to Deploy Audiobookshelf on a VPS →How to Deploy Authelia on a VPS →How to Deploy authentik on a VPS →How to Deploy Baserow on a VPS →How to Deploy Beszel on a VPS →How to Deploy Bitwarden on a VPS →How to Deploy BookStack on a VPS →How to Deploy CapRover on a VPS →How to Deploy Checkmate on a VPS →How to Deploy Directus on a VPS →How to Deploy docker-mailserver on a VPS →How to Deploy Docmost on a VPS →How to Deploy Dokku on a VPS →How to Deploy Dokploy on a VPS →How to Deploy Firefly III on a VPS →How to Deploy Forgejo on a VPS →How to Deploy Gatus on a VPS →How to Deploy Ghostfolio on a VPS →How to Deploy Gitea on a VPS →How to Deploy GitLab on a VPS →How to Deploy GlitchTip on a VPS →How to Deploy Graylog on a VPS →How to Deploy Headscale on a VPS →How to Deploy Healthchecks on a VPS →How to Deploy Home Assistant on a VPS →How to Deploy Immich on a VPS →How to Deploy Jan on a VPS →How to Deploy Jellyfin on a VPS →How to Deploy Karakeep on a VPS →How to Deploy Keycloak on a VPS →How to Deploy Leantime on a VPS →How to Deploy LibreChat on a VPS →How to Deploy Linkwarden on a VPS →How to Deploy LocalAI on a VPS →How to Deploy Mailcow on a VPS →How to Deploy Mailu on a VPS →How to Deploy Matomo on a VPS →How to Deploy Mattermost on a VPS →How to Deploy Meilisearch on a VPS →How to Deploy Memos on a VPS →How to Deploy n8n on a VPS →How to Deploy Navidrome on a VPS →How to Deploy NetBird on a VPS →How to Deploy Netdata on a VPS →How to Deploy Nextcloud on a VPS →How to Deploy Next.js to a VPS →How to Deploy Nginx Proxy Manager on a VPS →How to Deploy NocoDB on a VPS →How to Deploy ntfy on a VPS →How to Deploy Ollama on a VPS →How to Deploy Open WebUI on a VPS →How to Deploy OpenHands on a VPS →How to Deploy OpenObserve on a VPS →How to Deploy OpenProject on a VPS →How to Deploy Outline on a VPS →How to Deploy Pangolin on a VPS →How to Deploy Paperless-ngx on a VPS →How to Deploy Passbolt on a VPS →How to Deploy Plane on a VPS →How to Deploy Plausible Analytics on a VPS →How to Deploy Pocket ID on a VPS →How to Deploy PocketBase on a VPS →How to Deploy Prometheus on a VPS →How to Deploy Psono on a VPS →How to Deploy Radarr on a VPS →How to Deploy Rocket.Chat on a VPS →How to Deploy SigNoz on a VPS →How to Deploy Sonarr on a VPS →How to Deploy Stalwart on a VPS →How to Deploy Stirling-PDF on a VPS →How to Deploy Supabase on a VPS →How to Deploy Synapse on a VPS →How to Deploy Taiga on a VPS →How to Deploy TeamPass on a VPS →How to Deploy Tinyauth on a VPS →How to Deploy Traefik on a VPS →How to Deploy Trilium on a VPS →How to Deploy Twenty CRM on a VPS →How to Deploy Umami on a VPS →How to Deploy Uptime Kuma on a VPS →How to Deploy Vaultwarden on a VPS →How to Deploy Vikunja on a VPS →How to Deploy wg-easy on a VPS →How to Deploy Wiki.js on a VPS →How to Deploy Zabbix on a VPS →How to Deploy Zitadel on a VPS →How to Deploy Zulip on a VPS →Docker & Compose on Ubuntu 26.04 →Building AI Workflows with n8n →Install Open WebUI with Ollama →Adding AI-Powered Insights to Plausible Analytics →Building AI-Powered Apps with Supabase and pgvector →

We use analytics cookies (Google Analytics, PostHog) to see which guides are useful. No ad networks, no cross-site tracking. See our privacy policy.