October 21, 2021
How to install Prometheus on Debian 11

How To Install Prometheus On Debian 11

On this tutorial we will learn how to install Prometheus version 2.30 on Debian 11 operating system.


Prometheus is an open-source systems for event monitoring and alerting. Prometheus collects and stores its metrics as time series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels. Prometheus was developed at SoundCloud starting in 2012. On this article we will learn how to install Prometheus version 2.30 on Debian 11 operating system.


Prometheus’s main features are:

  • a multi-dimensional data model with time series data identified by metric name and key/value pairs
  • PromQL, a flexible query language to leverage this dimensionality
  • no reliance on distributed storage; single server nodes are autonomous
  • time series collection happens via a pull model over HTTP
  • pushing time series is supported via an intermediary gateway
  • targets are discovered via service discovery or static configuration
  • multiple modes of graphing and dashboarding support

Install Prometheus 2.30 On Debian 11

There are several ways to install Prometheus, namely: Using pre-compiled binaries, From source, Using Docker and Using configuration management systems. On this section, we will discuss how to install Prometheus on a Debian 11 operating system by using pre-compiled binaries. For the source file, can be downloaded at https://prometheus.io/download/. The installation will be consist of several steps, as described below :

1. Prerequisites

  • An updated Debian 11 operating system with root or user account with sudo privilege.
  • Sufficient space and good internet connection.

2. Create Prometheus System User

The first step is to create a Prometheus group and system user, this user will be used as the owner of the Prometheus application. For this purpose we will execute the command line :

sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
ramansah@otodiginet:~$ sudo groupadd --system prometheus
[sudo] password for ramansah:
ramansah@otodiginet:~$ sudo useradd -s /sbin/nologin --system -g prometheus prometheus
ramansah@otodiginet:~$ more /etc/passwd|grep prometheus

3. Download and Extract Prometheus Binary Files

At this stage, we will download the Promotheus source file using the curl command line, and extract the file. if there is no curl on our system, then we have to install it first. Then we will create a new folder to hold the temporary binary files before extraction, on this tutorial called as /tmp/promethues.

ramansah@otodiginet:~$ mkdir -p /tmp/prometheus && cd /tmp/prometheus
ramansah@otodiginet:/tmp/prometheus$ curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest|grep browser_download_url|grep linux-amd64|cut -d '"' -f 4|wget -qi -
ramansah@otodiginet:/tmp/prometheus$ ls -ltr
total 70924
-rw-r--r-- 1 ramansah ramansah 72625617 Oct  1 08:42 prometheus-2.30.2.linux-amd64.tar.gz
ramansah@otodiginet:/tmp/prometheus$ tar xvf prometheus*.tar.gz
After file extraction, the we will move the files to the right directory.
Download and Extract Prometheus binnary file
Download and Extract Prometheus binnary file
ramansah@otodiginet:/tmp/prometheus/prometheus-2.30.2.linux-amd64$ sudo mv prometheus.yml  /etc/prometheus/prometheus.yml
ramansah@otodiginet:/tmp/prometheus/prometheus-2.30.2.linux-amd64$ sudo mv consoles/ console_libraries/ /etc/prometheus/

4. Create Prometheus Configuration File

The Prometheus configuration file will be located located on /etc/prometheus/prometheus.yml. We just let it as default. The default value of this file is as follow :

ramansah@otodiginet:~$ cat /etc/prometheus/prometheus.yml
# my global config
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

      - targets: ["localhost:9090"]

5. Creating Prometheus systemd Service unit file

We will put Prometheus services to systemd, so we could manage it properly. To make it happen, then we have to create a file under /etc/systemd/system directories and make it mode to be executable by promtotheus user that we have created.

ramansah@otodiginet:~$ sudo vi /etc/systemd/system/prometheus.service

ExecReload=/bin/kill -HUP $MAINPID
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 \
  --web.listen-address= \


Creating Prometheus Systemd file
Creating Prometheus Systemd file

After file /etc/systemd/system/prometheus.service has been created, then we will change its permission.

ramansah@otodiginet:~$ for i in rules rules.d files_sd; do sudo chown -R prometheus:prometheus /etc/prometheus/${i}; done
[sudo] password for ramansah:
ramansah@otodiginet:~$ for i in rules rules.d files_sd; do sudo chmod -R 775 /etc/prometheus/${i}; done
ramansah@otodiginet:~$ sudo chown -R prometheus:prometheus /var/lib/prometheus/

After all are set, then we will reload and start Prometheus service, with the following command line :

ramansah@otodiginet:~$ sudo systemctl daemon-reload
ramansah@otodiginet:~$ sudo systemctl start prometheus

Then we will check the Prometheus service, by submitting command line :

ramansah@otodiginet:~$ systemctl status prometheus
● prometheus.service - Prometheus
     Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-10-05 04:26:08 EDT; 3min 4s ago
       Docs: https://prometheus.io/docs/introduction/overview/
   Main PID: 8471 (prometheus)
      Tasks: 8 (limit: 4623)
     Memory: 70.3M
        CPU: 269ms
     CGroup: /system.slice/prometheus.service
             └─8471 /usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/pro>
Prometheus Service has been running properly
Prometheus Service has been running properly

6. Access Prometheus Web Interface

As mentioned above on the /etc/prometheus/prometheus.yml file, if the Prometheus web interface will be live on URL localhost with port 9090. So we will hit the URL at http://localhost:9090 or hostname:9090.

Prometheus Web interface
Prometheus Web interface
Prometheus Runtime and Build information
Prometheus Runtime and Build information


The Prometheus version 2.30 (the latest stable version) installation on Debian 11 has been completed done. For more resource about Prometheus usage and integration with other application can be found on prometheus.io or other relevant website.

Share this article via :

Leave a Reply

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