OneStopList

Gods and goddesses

Install Prometheus on RHEL 9: Step-by-Step

Updated November 25, 2026

Yes, you can install Prometheus on RHEL 9 by downloading the official binary tarball from the Prometheus website, extracting it, and running it as a systemd service. This article walks you through the exact commands, configuration, and common pitfalls.

What Is Prometheus and Why Use It on RHEL 9?

Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. It collects time-series metrics from configured targets at given intervals, evaluates rule expressions, and can trigger alerts. On RHEL 9, Prometheus is not included in the default repositories, so you must install it manually. It is widely used because it has a simple data model, a powerful query language (PromQL), and integrates well with Kubernetes and other cloud-native tools.

Prerequisites

  • A RHEL 9 system with root or sudo access.
  • Internet connectivity to download the tarball.
  • Firewall rules allowing port 9090 (Prometheus web UI) and optionally 9100 (node_exporter).
  • Basic familiarity with systemd and command line.

Step 1: Download Prometheus

Visit the official Prometheus download page at https://prometheus.io/download/ to find the latest stable version. As of this writing, the latest is 2.53.0, but check for the current version. Use wget or curl to fetch the tarball:

cd /tmp
wget https://github.com/prometheus/prometheus/releases/download/v2.53.0/prometheus-2.53.0.linux-amd64.tar.gz

Replace the version number with the latest one you find. Extract it:

tar xvf prometheus-2.53.0.linux-amd64.tar.gz

Step 2: Create a Dedicated User and Directories

Running Prometheus as root is not recommended for security. Create a system user and directories:

sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus

Copy the binaries and configuration files:

sudo cp prometheus-2.53.0.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.53.0.linux-amd64/promtool /usr/local/bin/
sudo cp -r prometheus-2.53.0.linux-amd64/consoles /etc/prometheus
sudo cp -r prometheus-2.53.0.linux-amd64/console_libraries /etc/prometheus
sudo cp prometheus-2.53.0.linux-amd64/prometheus.yml /etc/prometheus/

Set ownership:

sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus

Step 3: Configure Prometheus

The default prometheus.yml file is minimal. Edit it to define scrape targets. For example, to monitor the local machine, add a job for node_exporter (if installed) or just keep the default self-monitoring job. Here is a basic configuration:

global:
  scrape_interval: 15s

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

Save the file. If you want to monitor other hosts, add more jobs with their IPs.

Step 4: Create a systemd Service

Create a service file so Prometheus starts on boot and runs in the background:

sudo vi /etc/systemd/system/prometheus.service

Add the following content:

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
Restart=always
RestartSec=3
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

Reload systemd and start Prometheus:

sudo systemctl daemon-reload
sudo systemctl start prometheus
sudo systemctl enable prometheus

Check status:

sudo systemctl status prometheus

Step 5: Access the Web UI and Verify

Open your browser and go to http://your-server-ip:9090. You should see the Prometheus expression browser. To verify it is scraping itself, go to Status > Targets. You should see the prometheus job with an UP state.

Step 6: Install Node Exporter (Optional)

To monitor system metrics like CPU and memory, install node_exporter. Download it from the same releases page:

wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar xvf node_exporter-1.8.2.linux-amd64.tar.gz
sudo cp node_exporter-1.8.2.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

Create a systemd service for it similarly, then add a scrape job in prometheus.yml pointing to localhost:9100.

Common Problems and Troubleshooting

  • Prometheus fails to start: Check logs with journalctl -u prometheus -f. Often it is a permissions issue on /var/lib/prometheus or a malformed YAML file.
  • Firewall blocking: If you cannot access the web UI, open port 9090: sudo firewall-cmd --permanent --add-port=9090/tcp && sudo firewall-cmd --reload.
  • SELinux: RHEL 9 has SELinux enforcing by default. If you get permission denied errors, check ausearch -m avc and possibly set the correct context on the binary and directories. Usually, placing binaries in /usr/local/bin and data in /var/lib/prometheus works without changes, but if not, you may need to adjust SELinux booleans or create a policy module.
  • Time series database corruption: If Prometheus crashes unexpectedly, the TSDB may be corrupted. Stop the service, move /var/lib/prometheus to a backup, and start fresh (you will lose historical data).

Security Considerations

By default, Prometheus has no authentication or encryption. If it is exposed to the internet, anyone can query it and potentially see sensitive data. Use a reverse proxy like Nginx with TLS and basic auth, or restrict access via firewall rules. Also, run Prometheus with a non-root user and ensure file permissions are locked down.

Alternatives and Comparisons

On RHEL 9, you might also consider Grafana for visualization (Prometheus itself has a basic UI), or VictoriaMetrics as a more efficient long-term storage backend. If you need a full monitoring stack, the Prometheus Operator on OpenShift or Kubernetes is an option. For simple monitoring, some prefer Netdata or Zabbix, but Prometheus is the standard for cloud-native environments.

Frequently Asked Questions

How do I update Prometheus on RHEL 9?

Download the new tarball, stop the service, replace the binary in /usr/local/bin, and restart. Preserve your prometheus.yml and data directory. Always back up before upgrading.

Can I install Prometheus using dnf?

No, Prometheus is not in the default RHEL 9 repositories. You can enable EPEL (Extra Packages for Enterprise Linux) and try dnf install prometheus, but the version there may be older. The official tarball is recommended for the latest features and security patches.

How do I scrape metrics from other servers?

Install node_exporter on each target server and add a job in prometheus.yml with the target IP:port. Ensure the firewall on those servers allows port 9100.

What is the default retention period for metrics?

Prometheus keeps data for 15 days by default. You can change it with --storage.tsdb.retention.time flag, e.g., --storage.tsdb.retention.time=30d.

Why is my Prometheus service failing with ‘permission denied’?

Check ownership of /var/lib/prometheus and /etc/prometheus. They must be owned by the prometheus user. Also verify that the binary is executable and SELinux is not blocking.

Related

How pages are sourced and corrected: Sources and editorial policy.