Prometheus and Grafana are a powerful open-source monitoring stack widely used in production Linux environments. Prometheus collects and stores time-series metrics, while Grafana provides rich dashboards and alerting on top of that data. Together they give you deep visibility into system performance, resource utilization, and application health. This tutorial walks through installing both on RHEL 9 and connecting them to visualize Node Exporter metrics.

Prerequisites

  • RHEL 9 server with a non-root sudo user or root access
  • Firewalld running (systemctl status firewalld)
  • At least 2 GB RAM and 10 GB free disk space
  • Internet access for downloading packages

Step 1 — Download and Install Prometheus

Download the latest Prometheus binary from the official GitHub releases page, extract it, and place the binaries in /usr/local/bin.

cd /tmp
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.51.2/prometheus-2.51.2.linux-amd64.tar.gz
tar xvf prometheus-2.51.2.linux-amd64.tar.gz
cd prometheus-2.51.2.linux-amd64

# Copy binaries
sudo cp prometheus /usr/local/bin/
sudo cp promtool /usr/local/bin/

# Create directories and copy config assets
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo cp -r consoles/ console_libraries/ /etc/prometheus/

Step 2 — Create the Prometheus User and Configuration

Create a dedicated system user for Prometheus, set ownership on the required directories, and write the initial configuration file.

# Create system user
sudo useradd --no-create-home --shell /bin/false prometheus

# Set ownership
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /usr/local/bin/prometheus /usr/local/bin/promtool

# Write configuration
sudo tee /etc/prometheus/prometheus.yml > /dev/null <<'EOF'
global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']
EOF

sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml

Step 3 — Create a Systemd Service for Prometheus

Create a systemd unit file so Prometheus starts automatically on boot and can be managed with systemctl.

sudo tee /etc/systemd/system/prometheus.service > /dev/null <<'EOF'
[Unit]
Description=Prometheus Monitoring
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus 
  --config.file=/etc/prometheus/prometheus.yml 
  --storage.tsdb.path=/var/lib/prometheus/ 
  --web.console.templates=/etc/prometheus/consoles 
  --web.console.libraries=/etc/prometheus/console_libraries 
  --web.listen-address=0.0.0.0:9090

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now prometheus
sudo systemctl status prometheus

Open firewall port 9090 so the Prometheus web UI is accessible:

sudo firewall-cmd --permanent --add-port=9090/tcp
sudo firewall-cmd --reload

Step 4 — Install Node Exporter

Node Exporter exposes hardware and OS metrics from the host. Install it similarly to Prometheus and run it as a systemd service on port 9100.

cd /tmp
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.8.0/node_exporter-1.8.0.linux-amd64.tar.gz
tar xvf node_exporter-1.8.0.linux-amd64.tar.gz
sudo cp node_exporter-1.8.0.linux-amd64/node_exporter /usr/local/bin/
sudo useradd --no-create-home --shell /bin/false node_exporter
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

sudo tee /etc/systemd/system/node_exporter.service > /dev/null <<'EOF'
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter

Step 5 — Install Grafana

Add the Grafana repository and install Grafana OSS using dnf. Then enable its service and open the web port.

# Add Grafana repo
sudo tee /etc/yum.repos.d/grafana.repo > /dev/null <<'EOF'
[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
sudo systemctl status grafana-server

# Open firewall port 3000
sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

Step 6 — Add Prometheus as a Data Source and Import the Node Exporter Dashboard

Log in to Grafana at http://<your-server-ip>:3000 with the default credentials (admin / admin). You will be prompted to change the password on first login. To add Prometheus as a data source via the Grafana API, run:

# Add Prometheus data source via API
curl -s -X POST http://admin:admin@localhost:3000/api/datasources 
  -H 'Content-Type: application/json' 
  -d '{
    "name": "Prometheus",
    "type": "prometheus",
    "url": "http://localhost:9090",
    "access": "proxy",
    "isDefault": true
  }'

# Import Node Exporter Full dashboard (ID 1860) via API
curl -s -X POST http://admin:admin@localhost:3000/api/dashboards/import 
  -H 'Content-Type: application/json' 
  -d '{
    "dashboard": {"id": null},
    "folderId": 0,
    "inputs": [{"name": "DS_PROMETHEUS","type": "datasource","pluginId": "prometheus","value": "Prometheus"}],
    "overwrite": true,
    "path": "https://grafana.com/api/dashboards/1860/revisions/latest/download"
  }'

Alternatively, in the Grafana UI navigate to Dashboards → Import, enter dashboard ID 1860, click Load, select the Prometheus data source, and click Import. You will immediately see CPU, memory, disk, and network panels populated with live data.

Conclusion

You now have a fully operational Prometheus and Grafana monitoring stack on RHEL 9. Prometheus is scraping metrics from itself and from Node Exporter every 15 seconds, and Grafana is displaying those metrics on the industry-standard Node Exporter Full dashboard. From here you can add additional scrape targets, define alerting rules in Prometheus, and configure Grafana notification channels to send alerts via email, Slack, or PagerDuty. Regularly check the prometheus.yml scrape configs and storage retention settings (--storage.tsdb.retention.time) as your environment grows.

Next steps: How to Set Up the ELK Stack on RHEL 9, How to Install Zabbix on RHEL 9, and How to Install Netdata on RHEL 9.