How to Install and Configure Prometheus tool on Linux Systems

Tipsonunix
3 min readJul 21, 2022

--

This tutorial will be helpful for beginners to Install and configure Prometheus tool on Linux systems (ie) Ubuntu , Rocky Linux , Fedora , AlmaLinux and Linux Mint.

What is Prometheus

Prometheus is a monitoring system designed to collect system metrics and alert on changes. It can be used to monitor server, container, and application performance, and to diagnose and troubleshoot issues.

Prometheus can collect data from a variety of sources, including system logs, process logs, and network interfaces. It can then use this data to generate alerts and graphs and to store historical data for later analysis.

Prometheus can be used to monitor a single system or an entire network. It can also be used to monitor systems in production or in development.

Prometheus has a variety of features that make it an ideal monitoring system. These features include:

- Easy to deploy

- Multiple Graphing and dashboards are supported

- Time series data collection happens via the Pull model over HTTP

- Highly Scalable

- Stores historical data

Install Prometheus on Linux systems

Step 1: Download the Prometheus tool from the downloads page or use the below command

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

Step 2: Extract the files

tar -xf prometheus-2.37.0.linux-amd64.tar.gz && mv prometheus-2.37.0.linux-amd64 /etc/prometheus

Step 3: Create a separate non-login user account for Prometheus

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

Step 4: Copy the Prometheus and Promtool to /usr/local/bin and change the Ownership of to executables and /etc/prometheus directoryPrometheus user.

sudo cp -pr /etc/prometheus/promtool prometheus /usr/local/bin/

sudo chown prometheus:prometheus /usr/local/bin/promtool
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus

Step 5: Create a Local storge directory and change the ownership to Prometheus also

sudo mkdir /var/lib/prometheus && sudo chown -R prometheus:prometheus /var/lib/prometheus

Configure Prometheus on Linux systems

Step 6: Create a service file for Prometheus and add the below contents to the file

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

Description=Prometheus

Wants=network-online.target

After=network-online.target

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

WantedBy=multi-user.target

Step 7: Reload the systemd and start the Prometheus service

sudo systemctl daemon-reload && systemctl start prometheus && systemctl enable prometheus

Prometheus Service

Step 8: Access Prometheus UI

From your browser type the server ip followed by 9090 port and press enter.

http://:9090

Prometheus UI

Prometheus Installation completed, you can run query from the available metrics

Conclusion

From this tutorial, you have learned how to download and install Prometheus tool on Ubuntu, Debian, Linux Mint, AlmaLinux, Rocky Linux and Fedora.

Do let us know your comments and feedback in the comments section below.

If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation

orange-button

Thank You for your support!!

--

--

Tipsonunix

Tipsonunix Provides Linux tutorial for beginners