Prometheus and Grafana are two of the most widely adopted open-source tools for infrastructure monitoring and metrics visualization. Prometheus scrapes and stores time-series data from your systems, while Grafana turns that data into rich, interactive dashboards. Together they give RHEL 8 administrators a powerful, production-ready observability stack. This tutorial walks through installing both tools from scratch, wiring them together, and importing a pre-built Node Exporter dashboard.

Prerequisites

  • A RHEL 8 server with a non-root sudo user
  • SELinux in enforcing mode (commands below handle the required policy adjustments)
  • Ports 9090 (Prometheus) and 3000 (Grafana) accessible through your firewall
  • wget and tar installed (dnf install -y wget tar)
  • At least 2 GB of free disk space under /var/lib

Step 1 — Download the Prometheus Binary

Prometheus is distributed as a pre-compiled Go binary. Download the latest stable release, extract it, and place the binaries on your PATH.

cd /tmp
wget 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

# Move binaries
sudo mv prometheus /usr/local/bin/
sudo mv promtool  /usr/local/bin/

# Move default config and console files
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo mv prometheus.yml /etc/prometheus/
sudo mv consoles/       /etc/prometheus/
sudo mv console_libraries/ /etc/prometheus/

Step 2 — Create the Prometheus System User and Set Permissions

Running Prometheus as a dedicated, unprivileged user reduces the attack surface. Create the user, then assign ownership of all Prometheus paths to it.

sudo useradd --no-create-home --shell /bin/false prometheus

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

Step 3 — Configure Prometheus

Edit the main configuration file to define a scrape interval and add the local Node Exporter as a target. Replace the default contents of /etc/prometheus/prometheus.yml with the block below.

sudo tee /etc/prometheus/prometheus.yml > /dev/null <<'EOF'
global:
  scrape_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 4 — Create a systemd Service for Prometheus

A systemd unit file ensures Prometheus starts on boot and is managed with standard systemctl commands. Create the unit, then enable and start it.

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

[Install]
WantedBy=multi-user.target
EOF

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

Step 5 — Open Firewall Port 9090 and Install Grafana

Allow inbound traffic to Prometheus, then add the official Grafana repository and install the package. Grafana listens on port 3000 by default.

# Firewall rules
sudo firewall-cmd --permanent --add-port=9090/tcp
sudo firewall-cmd --permanent --add-port=3000/tcp
sudo firewall-cmd --reload

# Add Grafana repo
sudo tee /etc/yum.repos.d/grafana.repo > /dev/null <<'EOF'
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.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

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

Open Grafana in your browser at http://<server-ip>:3000 (default credentials admin / admin). Navigate to Connections → Data sources → Add data source, choose Prometheus, and set the URL to http://localhost:9090. Save and test the connection. To import the community Node Exporter Full dashboard, go to Dashboards → Import, enter dashboard ID 1860, select your Prometheus data source, and click Import. You will immediately see CPU, memory, disk I/O, and network panels populated with live data from your RHEL 8 host.

# Verify Prometheus scrape targets are healthy
curl -s http://localhost:9090/api/v1/targets | python3 -m json.tool | grep '"health"'

# Check Grafana logs if the UI is unreachable
sudo journalctl -u grafana-server -n 50 --no-pager

Conclusion

You now have a fully operational Prometheus and Grafana monitoring stack running on RHEL 8. Prometheus is collecting metrics from itself and is ready to scrape additional exporters, while Grafana provides a polished dashboard interface backed by the Prometheus data source. The Node Exporter Full dashboard (ID 1860) gives you immediate visibility into host-level resource utilization with no extra configuration required. From here you can extend the stack by adding alert rules, configuring Alertmanager for notifications, or scraping application-specific exporters for databases, web servers, and containers.

Next steps: Setting Up Alertmanager for Prometheus on RHEL 8, Installing Node Exporter on Multiple RHEL 8 Hosts, and Securing Prometheus and Grafana with HTTPS and Authentication.