DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel  •  DevOps · K8s · Volleyball · Travel
Explore NY Stream

Install Prometheus and Grafana on Linux: A Clear Setup Guide

— ny_wk

Install Prometheus and Grafana on Linux: A Clear Setup Guide

Prometheus and Grafana are the classic open-source monitoring duo: Prometheus collects and stores metrics with solid alerting, and Grafana turns them into dashboards you'll actually look at. Here's a clean walkthrough to get both running on a Linux server.

Before you begin

  • sudo access on the server (the steps need elevated privileges).
  • Internet access to download the binaries.
  • Firewall open for Prometheus on port 9090 and Grafana on 3000.

Part 1 — Install Prometheus

  1. Update the system: sudo yum update -y (or apt update on Debian/Ubuntu).
  2. Create a dedicated user so Prometheus doesn't run as root: sudo useradd --no-create-home --shell /bin/false prometheus.
  3. Download the latest Linux binary from the official Prometheus downloads page and extract it.
  4. Place the files: move prometheus and promtool into /usr/local/bin, and the config/console files into /etc/prometheus; set ownership to the prometheus user.
  5. Create a systemd service (/etc/systemd/system/prometheus.service) pointing at the binary and --config.file=/etc/prometheus/prometheus.yml.
  6. Start it: sudo systemctl daemon-reload && sudo systemctl enable --now prometheus.

Open http://<server-ip>:9090 — the Prometheus UI confirms it's running.

Part 2 — Install Grafana

  1. Add the Grafana repo and install with your package manager (yum install grafana / apt install grafana).
  2. Start it: sudo systemctl enable --now grafana-server.
  3. Browse to http://<server-ip>:3000 and log in (default admin/admin — change it immediately).

Part 3 — Connect them

In Grafana: Connections → Data sources → Add data source → Prometheus, set the URL to http://localhost:9090, and Save & Test. Then import a ready-made dashboard (e.g., Node Exporter) by ID, and you have live charts in minutes.

Key takeaways

  • Prometheus scrapes and stores metrics (port 9090); Grafana visualizes them (port 3000).
  • Run Prometheus as a dedicated non-root user via a systemd service.
  • Open the firewall ports and change Grafana's default password.
  • Add Prometheus as a Grafana data source, then import a dashboard.

Frequently asked questions

Do Prometheus and Grafana have to be on the same server?

No — Grafana just needs network access to Prometheus's URL. Same box is simplest for a start.

What collects the actual metrics?

Exporters (like Node Exporter for host metrics). Prometheus scrapes those exporter endpoints on a schedule.

Why run Prometheus as a non-root user?

Security — limit what the process can touch. A dedicated prometheus user with a systemd service is best practice.

How do I get dashboards quickly?

Import community dashboards by ID in Grafana (e.g., the Node Exporter dashboard) instead of building from scratch.

Binary + systemd for Prometheus, package install for Grafana, wire them together — and you've got real observability running the same afternoon.