How To Install Prometheus on Debian 11

On this short tutorial, we will learn how to install Prometheus 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 on Debian 11 operating system.

Prometheus Installation Guide on Debian 11


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

Prometheus installation steps

On this section, we will discuss how to install Promeutheus on a Debian 11 operating system. The installation will be consist of several steps, as described below :

  • Create Prometheus group and user system
  • Create new directory for Prometheus data
  • Download and Extract Prometheus binary files
  • Create Prometheus Configuration file
  • Create Prometheus systemd service unit file
  • Accessing Prometheus Web Interface

1. Create Prometheus group and user system

The first step on installing Prometheus monitoring tools on Debian 11 is to create a new group and user system for holding application data and privilege, where the applications will be running rely on this user. To create a new group and user, we will use the following command line :

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

Output :

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

Check the result on /etc/passwd file, as shown below :

:~$ more /etc/passwd|grep prometheus

Output :

ramansah@otodiginet:~$ more /etc/passwd|grep prometheus

2. Create New Directory for Prometheus Data

On this stage, we will create a new directory for Prometheus data and configuration files. For this purpose we will use mkdir command line as shown below.

ramansah@otodiginet:~$ sudo mkdir /var/lib/prometheus
ramansah@otodiginet:~$ for i in rules rules.d files_sd; do sudo mkdir -p /etc/prometheus/${i}; done

3. Download and Extract Prometheus binary files

Now we will download Prometheus archive and extract it to get binary files. We will download the release from Prometheus releases Github page.

$ sudo apt-get update
$ mkdir -p /tmp/prometheus && cd /tmp/prometheus
$ curl -s|grep browser_download_url|grep linux-amd64|cut -d '"' -f 4|wget -qi -

Output :

ramansah@otodiginet:~$ mkdir -p /tmp/prometheus && cd /tmp/prometheus
ramansah@otodiginet:/tmp/prometheus$ curl -s|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

Then we will extract it by using tar command line :

$ tar xvf prometheus*.tar.gz

Output :

ramansah@otodiginet:/tmp/prometheus$ tar xvf prometheus*.tar.gz

Then we will move promtheus.yml, consoles and console_libraries file to /etc/promotheus :

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 default configuration file looks similar to below.

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. Create Prometheus systemd Service Unit File

On this stage, we will create a systemd service unit file for Prometheus. We will create a new file called as /etc/systemd/system/prometheus.service, with the following entry:


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= \



Then we will changes the files mode and restart Promotheus service with the following command lines :

$ for i in rules rules.d files_sd; do sudo chown -R prometheus:prometheus /etc/prometheus/${i};
$ for i in rules rules.d files_sd; do sudo chmod -R 775 /etc/prometheus/${i};
sudo chown -R prometheus:prometheus /var/lib/prometheus/

Output :

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/

Reload Prometheus service by submitting command lines :

$ sudo systemctl daemon-reload
$ sudo systemctl start prometheus
$ systemctl status prometheus

Output :

ramansah@otodiginet:~$ sudo systemctl daemon-reload
ramansah@otodiginet:~$ sudo systemctl start prometheus
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
   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>
Reload Prometheus Service
Reload Prometheus Service

We also can verify Prometheus version by submitting command line :

$ prometheus --version

Output :

ramansah@otodiginet:~$ prometheus --version
prometheus, version 2.30.2 (branch: HEAD, revision: b30db03f35651888e34ac101a06e25d27d15b476)
  build user:       root@80d1e84a93dd
  build date:       20211001-12:26:58
  go version:       go1.17.1
  platform:         linux/amd64

6. Accessing Prometheus Web Interface

After all are configured, then we will test Prometheus service by accessing its web porta. The Prometheus web can be accessed on URL : http://<server_name_or_ip_address>:9090, as shown below:

Prometheus web interface
Prometheus web interface
Prometheus web interface status
Prometheus web interface Status
Prometheus web interface memory stats
Prometheus web interface | memory Stats


On this short tutorial, we have shown you how to install Prometheus monitoring tools on Debian 11 operating system. I hope this tutorial we be helpful.

Add a Comment

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