Introduction

Grafana and Prometheus are powerful monitoring tools used to visualize and analyze metrics from various sources. This tutorial will guide you through the process of installing Grafana and Prometheus on Rocky Linux 9.

Prerequisites

Before you begin, ensure you have:

  1. A Rocky Linux 9 server or desktop system
  2. SSH access to the server (optional)
  3. Root or sudo privileges

Step 1: Install Prometheus

Run the following commands to install Prometheus:

sudo dnf install -y wget
sudo wget https://github.com/prometheus/prometheus/releases/download/v2.34.0/prometheus-2.34.0.linux-amd64.tar.gz
sudo tar -zxvf prometheus-2.34.0.linux-amd64.tar.gz
cd prometheus-2.34.0.linux-amd64
sudo cp prometheus promtool /usr/local/bin/

Step 2: Install Grafana

Add the Grafana repository and install Grafana:

sudo wget https://dl.grafana.com/oss/release/grafana-8.3.3-1.x86_64.rpm
sudo dnf install -y grafana-8.3.3-1.x86_64.rpm

Step 3: Configure Prometheus

Configure Prometheus by creating a configuration file prometheus.yml:

sudo nano /etc/prometheus/prometheus.yml

Add the following configuration:

global:
  scrape_interval: 15s

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

Step 4: Start Prometheus and Grafana Services

Start Prometheus and Grafana services:

sudo systemctl start prometheus
sudo systemctl enable prometheus
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Step 5: Access Grafana Web Interface

Open a web browser and navigate to http://your_server_ip:3000 to access the Grafana web interface.

Step 6: Configure Grafana

Log in to Grafana with the default credentials (admin/admin) and follow the on-screen instructions to set up a data source and create dashboards.

Conclusion

Congratulations! You have successfully installed Grafana and Prometheus on Rocky Linux 9. You can now use Grafana to visualize and analyze metrics collected by Prometheus.

Was this answer helpful? 0 Users Found This Useful (0 Votes)