Loading...

How to Install Prometheus on CentOS 8

Simple.Predictable.Scalable

Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing Prometheus on CentOS 8

Prometheus is an open-source monitoring and alerting tool, designed for collecting and processing metrics from various systems. It provides a flexible query language, powerful visualizations, and alerting capabilities. Prometheus follows a pull-based model, where it regularly scrapes targets to collect metrics.

Step 1: Update System

Before installing Prometheus, it is recommended to update your CentOS 8 system to ensure you have the latest packages and security updates.

sudo dnf update -y

Step 2: Download Prometheus

Download the latest stable version of Prometheus from the official website.

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

Step 3: Extract Prometheus

Extract the downloaded Prometheus tarball.

tar xvfz prometheus-2.29.0.linux-amd64.tar.gz

Step 4: Configure Prometheus

Create and edit the prometheus.yml configuration file.

cd prometheus-2.29.0.linux-amd64
nano prometheus.yml

Add the necessary configurations for your targets, such as scraping endpoints, jobs, and metric paths.

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']

Step 5: Start Prometheus

Start Prometheus using the provided binary.

./prometheus --config.file=prometheus.yml

Prometheus will start and begin scraping the configured targets for metrics.

Step 6: Access Prometheus Web UI

Access the Prometheus Web UI by opening a web browser and navigating to http://localhost:9090.

From the Web UI, you can explore the collected metrics, run queries, create visualizations, and set up alerting rules.

Step 7 (Optional): Configure Prometheus as a Service

To run Prometheus as a service, you can create a systemd unit file.

sudo nano /etc/systemd/system/prometheus.service

Add the following content to the unit file:

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/path/to/prometheus --config.file=/path/to/prometheus.yml

[Install]
WantedBy=default.target

Replace /path/to/prometheus and /path/to/prometheus.yml with the actual paths to your Prometheus binary and configuration file.

Save and close the file. Then, enable and start the Prometheus service:

sudo systemctl enable --now prometheus

Now Prometheus will automatically start on system boot and run as a background service.

Conclusion

Congratulations! You have successfully installed Prometheus on CentOS 8. You can now use Prometheus to monitor and collect metrics from your systems and applications.

Refer A Friend
Get $25

Installing
Prometheus
CentOS 8
Prometheus installation
Prometheus setup
CentOS 8 installation
CentOS 8 setup
installing Prometheus on CentOS 8
Prometheus on CentOS 8
how to install Prometheus on CentOS 8.

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.