Installing Prometheus on Ubuntu 22.04

Prometheus is an open source hardware monitoring tool that stores real-time metrics records in a time-series database, Prometheus based on a pull mechanism that uses the HTTP protocol. 

In this post, We will install and cosudo systemctl enable prometheus.servvicenfigure the prometheus on ubuntu 22.04 LTS machine.

Step 1: Create System User for Prometheus

This is a custom installation of prometheus on ubuntu, We need to create a system user and group as well by following the given command.

To create a prometheus group.

sudo groupadd --system prometheus

To create a prometehus user with no-login shell.

sudo useradd -s /sbin/nologin --system -g prometheus prometheus

Step 2: Create Prometehus Directory

Prometheus required a 2 directory to contain the configuration file, So that’s why we need to create a directory, Execute the follwing command for the same.

To create main direcory for prometheus.

sudo mkdir /etc/prometheus

To create sub directory for prometheus.

sudo mkdir /var/lib/prometheus

Step 3: Download Prometheus & Extract the file

We need to download the prometheus’s tar file, Execute the given command for the same and if you want install different version so then you need to visiti and copy the update prometheus tar file URL from here

To download the prometheus tar.


To extract the prometehus tar file.

tar vxf prometheus*.tar.gz

Step 4: Configure the Prometheus

We need to move the prometheus direcotry struture in /usr/local/bin , We need to follow the given command for the same.

To change directory.

cd prometheus*/

To move the prometheus required directory.

sudo mv prometheus promtool /usr/local/bin/

To verify the prometheus version.

prometheus --version

Step 5: Configure Prometheus files

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

Step 6: Create Prometheus Service

We need to create a prometheus.service file to control the prometehus daemon by execution the following command.

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

Paste the following code.

ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \


Whenever we create any service So than we need to reload the reload daemon, Use the given command for the same.

sudo systemctl daemon-reload

This is a good pratice to enable the prometehus service on boot, Use the given command for the same.

sudo systemctl enable prometheus.service

We are ready to start the prometehus service now.

sudo systemctl start prometheus.service

To see the prometheus service running or not, We need to use the given command.

sudo systemctl status prometheus.service

We must have up and running service, To access prometheus we need to open the port 9090 this is by defaut port to use, We need to open the browser with machine ip.

http://localhost:9090 or https://YOUR_IP_ADDRESS:9090


We have successfully installed prometheus server on ubuntu 22.04 LTS, If you still have questions, please post them in the comments section below.


Installing Prometheus on Ubuntu 22.04

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top