A Step-by-Step Guide to Installing Prometheus on Ubuntu 24.04

In this article, we cover how to install Prometheus in Ubuntu 24.04 release. Prometheus is one of the most popular open-source monitoring and alerting tools. It was originally developed at SoundCloud. It stores all data as time series.

Note: The following operations require Administrative rights to make changes. If you lack the necessary privileges then contact your System Administrator for assistance.

Install Prometheus in Ubuntu 24.04

Step 1. Download the Prometheus package.

The package isn’t available through the standard Ubuntu repository. Therefore, download the package: .tar.gz file from the Download page of Prometheus. Choose Linux as the Operating System and your system’s architecture.

We went ahead with the LTS release and architecture as amd64. Therefore, we got the package file: prometheus-2.45.3.linux-amd64.tar.gz

It could be different for you depending on the LTS release.

Step 2. Extract the downloaded package

Use the tar command-line utility to extract the downloaded package:

cd /path/to/prometheus/package
tar -xvf prometheus-2.45.3.linux-amd64.tar.gz

This would create a directory prometheus-2.45.3.linux-amd64/ in the current directory.

Step 3. Move necessary files from the extracted package to desired directories

cd prometheus-2.45.3.linux-amd64/
sudo mv prometheus /usr/local/bin/
sudo mv promtool /usr/local/bin/

Create a new directory /etc/prometheus through the mkdir command-line utility:

sudo mkdir /etc/prometheus

And, move the following to /etc/prometheus

sudo mv consoles/ /etc/prometheus
sudo mv console_libraries/ /etc/prometheus
sudo mv prometheus.yml /etc/prometheus/

Step 4. Create a systemd service for Prometheus

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

And, append the file with the following:

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

[Service]
ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml
Restart=always

[Install]
WantedBy=default.target

Step 5. Reload the service

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

Step 6. Open a web browser and enter the following URL:

http://localhost:9090/

In conclusion, we have covered here how to install Prometheus in the Ubuntu 24.04 release.

Similar Posts