top of page
Recent Posts

How to install and configure Prometheus & grafana in Red Hat Enterprise Linux 7

Updated: Oct 3, 2021

Prometheus is an open-source systems monitoring and alerting toolkit originally built at SoundCloud. The Prometheus ecosystem consists of multiple components, many of which are optional:

  • the main Prometheus server which scrapes and stores time series data

  • client libraries for instrumenting application code

  • a push gateway for supporting short-lived jobs

  • special-purpose exporters for services like HAProxy, StatsD, Graphite, etc.

  • an alertmanager to handle alerts

  • various support tools

Grafana is open source visualization and analytics software. It allows you to query, visualize, alert on, and explore your metrics no matter where they are stored. In plain English, it provides you with tools to turn your time-series database (TSDB) data into beautiful graphs and visualizations. Grafana supports querying Prometheus.

The architecture of Prometheus and some of its ecosystem components:

And Prometheus + Grafana could be the complementary services that consider as a tools to build up a monitoring system. Lets start the configuration.

Installing Prometheus Server:

Step:1 To download Prometheus binaries for Linux from

# cd /tmp/ 
# wget 

::::::::::::: CUT SOME OUTPUT :::::::::::::

100%[========================================================================================================>] 65,312,139   287KB/s   in 5m 25s 
2020-07-25 18:16:23 (196 KB/s) - ‘prometheus-2.20.0.linux-amd64.tar.gz’ saved [65312139/65312139]

Step:2 To prepared prerequisite configurations for Prometheus.

# ueradd --no-create-home -s /bin/false prometheus
# mkdir /etc/prometheus
# mkdir /var/lib/prometheus
# chown prometheus:prometheus /etc/prometheus
# chown prometheus:prometheus /var/lib/prometheus

Step:3 To extract downloaded zip file & configure Prometheus.

# tar -zxvf /root/prometheus-2.20.0.linux-amd64.tar.gz 
::::::::::::: CUT SOME OUTPUT :::::::::::::

# mv /var/lib/prometheus/prometheus.yml /etc/prometheus/
# chown -R prometheus:prometheus /var/lib/prometheus

# mv /var/lib/prometheus/prometheus.yml /etc/prometheus/
# ln -s /var/lib/prometheus/prometheus /usr/local/bin/prometheus

Step:4 To create a systemd configuration file for Prometheus.

# vi /usr/lib/systemd/system/prometheus.service

ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--web.console.templates=/var/lib/prometheus/consoles \


Step:5 To start the Prometheus service.

# systemctl enable --now prometheus
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/prometheus.service.
# systemctl status prometheus

Step:6 To open port in firewall, if firewall service is running.

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

Step:7 To verify the Prometheus service, open the URL http://<prometheus_ipaddress>:9090 using a client's browser.

OK, good to go for the next.

Installing Node_Exporter:

Prometheus receives metrics from many sources like machines, databases, applications, etc. But the most common Exporter that we prefer to install on each node to collect machine metrics is the node_exporter. Let's install the Node_Exporter.

Step:1 To download Node_Exporter from Prometheus Download Page.

# cd /tmp
# wget
--2020-07-27 13:19:58-- 

::::::::::::: CUT SOME OUTPUT :::::::::::::

100%[========================================================================================================>] 9,520,728    149KB/s   in 57s    
::::::::::::: CUT SOME OUTPUT :::::::::::::
2020-07-27 13:20:57 (164 KB/s) - ‘node_exporter-1.0.1.linux-amd64.tar.gz’ saved [9520728/9520728]

Step:2 To prepared prerequisite configurations for Node_Exporter.

# ueradd --no-create-home -s /bin/false prometheus
# mkdir -p /var/lib/prometheus/node_exporter

Step:3 To extract downloaded zip file & configure Node_Exporter.

# tar xvf node_exporter-1.0.1.linux-amd64.tar.gz 
# mv node_exporter-1.0.1.linux-amd64/* /var/lib/prometheus/node_exporter
# chown -R prometheus:prometheus /var/lib/prometheus/node_exporter/

Step:4 To create a systemd configuration file for Node_Exporter.