Install Prometheus and Grafana on Linux: A Clear Setup Guide
— ny_wk

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
- Update the system:
sudo yum update -y(orapt updateon Debian/Ubuntu). - Create a dedicated user so Prometheus doesn't run as root:
sudo useradd --no-create-home --shell /bin/false prometheus. - Download the latest Linux binary from the official Prometheus downloads page and extract it.
- Place the files: move
prometheusandpromtoolinto/usr/local/bin, and the config/console files into/etc/prometheus; set ownership to the prometheus user. - Create a systemd service (
/etc/systemd/system/prometheus.service) pointing at the binary and--config.file=/etc/prometheus/prometheus.yml. - 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
- Add the Grafana repo and install with your package manager (
yum install grafana/apt install grafana). - Start it:
sudo systemctl enable --now grafana-server. - Browse to
http://<server-ip>:3000and log in (defaultadmin/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.