Guides / Monitoring

How to Install & Set Up Grafana

Install Grafana OSS from the official APT repository (or Docker), connect a Prometheus data source through the UI or as code, and build your first dashboard.

Updated 20268-step setupDownload Grafana →

Prerequisites

  • ✓A Linux host
  • ✓A data source such as Prometheus, Loki, or a SQL database — the walkthrough below assumes Prometheus running on the same host

How Grafana fits together

Grafana itself doesn't store your metrics or logs — it's a query and visualization layer that sits in front of data sources (Prometheus, Loki, InfluxDB, plain SQL, dozens of others) and translates each one's native query language into panels on a dashboard. A dashboard is just a JSON document describing a grid of panels, each pointed at a data source and a query; that JSON is exportable, importable, and diffable, which is what makes dashboards-as-code practical.

Install on Ubuntu/Debian (APT repo)

terminal
sudo apt-get install -y apt-transport-https software-properties-common wget
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install -y grafana
sudo systemctl enable --now grafana-server

Install on RHEL, CentOS Stream, or Fedora (official RPM repo)

terminal
cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF
sudo dnf install -y grafana
sudo systemctl enable --now grafana-server

Alternative — run Grafana in Docker

terminal
docker run -d -p 3000:3000 --name grafana grafana/grafana-oss

Verify and log in

Open http://your-host:3000 and sign in with admin / admin — you'll be prompted to set a new password immediately.

Connect a data source through the UI

Connections → Data sources → Add data source → Prometheus, then point the URL at wherever Prometheus is listening (http://localhost:9090 if it's on the same box) and hit Save & test.

Provision data sources and dashboards as code

Clicking through the UI every time you stand up a new Grafana instance doesn't scale. Drop YAML files into Grafana's provisioning directories and it picks them up on startup — the same data sources and dashboards, defined once, checked into Git.

/etc/grafana/provisioning/datasources/prometheus.yaml
apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://localhost:9090
    isDefault: true
/etc/grafana/provisioning/dashboards/default.yaml
apiVersion: 1
providers:
  - name: default
    folder: ""
    type: file
    options:
      path: /var/lib/grafana/dashboards
!

Drop exported dashboard JSON files into /var/lib/grafana/dashboards and restart grafana-server — they'll show up under the folder you configured, no manual import needed.

Build your first dashboard

Dashboards → New → New Dashboard → Add visualization, pick the Prometheus data source, and try a query like rate(node_cpu_seconds_total{mode="idle"}[5m]) — the same PromQL you'd run in Prometheus's own expression browser, now rendered as a time series panel you can save and share.

Documentation & Knowledge Base

Official DocumentationGrafana Documentation →Knowledge Base & CommunityGrafana Community Forums →
Download Grafana— all versions & official links→

Related Guides

PrometheusInstall guide →Grafana LokiInstall guide →VictoriaMetricsInstall guide →

Need Grafana deployed and managed for you?

We're OpenStack Dev — we design, deploy, and operate production DevOps infrastructure.

Get in TouchAll Install Guides