cara install prometheus di rhel


 















1. Instal & Siapkan Prometheus

Buat pengguna

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

Download Prometheus (WAJIB pakai versi, jangan wildcard)

cd /opt
wget https://github.com/prometheus/prometheus/releases/download/v3.11.2/prometheus-3.11.2.linux-amd64.tar.gz

Ekstrak & ganti nama

tar -xvzf prometheus-3.11.2.linux-amd64.tar.gz
mv prometheus-3.11.2.linux-amd64 prometheus

Buat folder penting

mkdir -p /etc/prometheus
mkdir -p /var/lib/prometheus

Salin berkas

cp /opt/prometheus/prometheus /usr/local/bin/
cp /opt/prometheus/promtool /usr/local/bin/
cp /opt/prometheus/prometheus.yml /etc/prometheus/

Atur izin

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

2. Buat Layanan Prometheus

nano /etc/systemd/system/prometheus.service

Isi:

[Unit]
Description=Prometheus
After=network.target

[Service]
User=prometheus
ExecStart=/usr/local/bin/prometheus \
 --config.file=/etc/prometheus/prometheus.yml \
 --storage.tsdb.path=/var/lib/prometheus

[Install]
WantedBy=multi-user.target

Aktifkan layanan

systemctl daemon-reexec
systemctl daemon-reload
systemctl enable --now prometheus

Cek jalan

ss -tulnp | grep 9090

✔ harus muncul port 9090


3. Instal Apache (Reverse Proxy)

Server HTTP Apache

dnf install httpd -y
systemctl enable --now httpd

Pastikan modul proxy aktif

httpd -M | grep proxy

Kalau belum ada:

nano /etc/httpd/conf.modules.d/00-proxy.conf

Pastikan:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

4. Konfigurasi VirtualHost (Subdomain)

nano /etc/httpd/conf.d/prometheus.conf

Isi:

<VirtualHost *:80>
    ServerName prometheus.17-tkja.lab

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:9090/
    ProxyPassReverse / http://127.0.0.1:9090/
</VirtualHost>

Mulai ulang Apache

systemctl restart httpd

5. Mengatur DNS (BIND)

Server DNS BIND

Zona pengeditan

nano /var/named/17-tkja.lab.db

Tambahkan:

prometheus   IN  A   10.100.100.128

Naikkan SERIAL

Contoh:

2026041403 → 2026041404

Mulai ulang DNS

systemctl restart named

6. Testing DNS (WAJIB pakai DNS sendiri)

dig @127.0.0.1 prometheus.17-tkja.lab

✔ harus muncul:

promo.17-tkja.lab.   IN   A   10.100.100.128

7. Tes di Browser

http://prometheus.17-tkja.lab

✔ harus masuk Prometheus

Komentar

Postingan populer dari blog ini

Logging in ke Mikrotik RB (952-5AC2ND) Menggunakan Win Box

Instalasi Redhat Di Virtual Box 7.2.2

instalasi debian 11 di virtualbox