How to install Prometheus Server on Centos Linux and Integrate it with Grafana Server

Опубликовано: 29 Май 2026
на канале: Avinashkumar - The Learning Destination
7,464
83

This tutorial helps you to configure Prometheus Server on Centos Linux and integrate it with Grafana as a Data Source.

The following commands has been used under this Tutorial:

wget https://github.com/prometheus/prometh...
Add Prometheus User
useradd --no-create-home --shell /bin/false prometheus

Create diectory and change ownership
mkdir /etc/prometheus
mkdir /var/lib/prometheus
chown prometheus:prometheus /etc/prometheus
chown prometheus:prometheus /var/lib/prometheus

#Extract Prmetheus file & rename it.

tar -xvzf prometheus-2.8.1.linux-amd64.tar.gz
mv prometheus-2.8.1.linux-amd64 prometheuspackage

Copy “prometheus” and “promtool” binary and change ownership

cp prometheuspackage/prometheus /usr/local/bin/
cp prometheuspackage/promtool /usr/local/bin/
chown prometheus:prometheus /usr/local/bin/prometheus
chown prometheus:prometheus /usr/local/bin/promtool

Copy “consoles” and “console_libraries”
cp -r prometheuspackage/consoles /etc/prometheus
cp -r prometheuspackage/console_libraries /etc/prometheus
chown -R prometheus:prometheus /etc/prometheus/consoles
chown -R prometheus:prometheus /etc/prometheus/console_libraries

Configure Prmetheus
vi /etc/prometheus/prometheus.yml

global:
scrape_interval: 10s

scrape_configs:
job_name: 'prometheus_master'
scrape_interval: 5s
static_configs:
targets: ['SERVER_IP:9090']

Change the ownership
chown prometheus:prometheus /etc/prometheus/prometheus.yml

vi /etc/systemd/system/prometheus.service

[Unit]
Description=Prometheus
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

#start service
systemctl daemon-reload
systemctl start prometheus
systemctl status prometheus

http://SERVER_IP:9090/graph

Install Node Exporter

wget https://github.com/prometheus/node_ex...

tar -xvzf node_exporter-0.17.0.linux-amd64.tar.gz
useradd -rs /bin/false nodeusr
mv node_exporter-0.17.0.linux-amd64/node_exporter /usr/local/bin/

vim /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=nodeusr
Group=nodeusr
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target


systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter

http://SERVER_IP:9100/metrics

Login on Prometheus server again
vim /etc/prometheus/prometheus.yml
job_name: 'node_exporter_centos'
scrape_interval: 5s
static_configs:
targets: ['CLIENT_IP:9100']


systemctl restart prometheus

http://SERVER_IP:9090/targets

Select
Node_memory_MemFree_bytes

Please subscribe my Travel Vlogging Channel as well:    • Pulau Ubin: My first Vlog on bicycle 🚲 || ...