Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save OndrejValenta/4e4ee26aede02ac5e6ae041fb58fdfb2 to your computer and use it in GitHub Desktop.
Save OndrejValenta/4e4ee26aede02ac5e6ae041fb58fdfb2 to your computer and use it in GitHub Desktop.
Install Grafana/Loki/Prometheus on RockyLinux 9

Installation of Grafana on RHEL

wget -q -O gpg.key https://rpm.grafana.com/gpg.key sudo rpm --import gpg.key

nano /etc/yum.repos.d/grafana.repo and paste

[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
exclude=*beta*

run sudo dnf install grafana -y

Installation of Loki

dnf install loki promtail -y

Installation of Prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.50.1/prometheus-2.48.1.linux-amd64.tar.gz

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

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

cp prometheus/prometheus /usr/local/bin/ cp prometheus/promtool /usr/local/bin/

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

cp -r prometheus/consoles /etc/prometheus cp -r prometheus/console_libraries /etc/prometheus

chown -R prometheus:prometheus /etc/prometheus/consoles chown -R prometheus:prometheus /etc/prometheus/console_libraries

nano /etc/prometheus/prometheus.yml

` global: scrape_interval: 10s

scrape_configs:

  • job_name: 'prometheus_master' scrape_interval: 5s static_configs:
    • targets: ['localhost:9090'] `

chown prometheus:prometheus /etc/prometheus/prometheus.yml

nano /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 `

systemctl daemon-reload

systemctl enable --now prometheus systemctl start --now prometheus systemctl status prometheus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment