Install Prometheus on Debian 10


In this guide, we are going to learn how to install Prometheus on Debian 10. Prometheus is an open-source systems and service monitoring system. It collects metrics from configured targets via HTTP calls at given intervals, evaluates rule expressions, displays the results, and can trigger alerts if some conditions are met.

Install Prometheus on Debian 10

Prometheus is made up various components;

  • The main Prometheus server which scrapes and stores time series data
  • Client libraries for instrumenting application code
  • Push gateway for supporting short-lived jobs
  • Exporters for exporting existing metrics from third-party systems as Prometheus metrics in cases where it is not feasible to instrument a given system with Prometheus metrics directly for example in services like HAProxy, StatsD, Graphite, etc.
  • Alertmanager to handle alerts.

Prometheus and its other components are available on the default Debian 10 repositories. However, the available versions may not be up-to-date. You can verify the available versions by running the command below;

apt-cache policy prometheus
  Installed: (none)
  Candidate: 2.7.1+ds-3+b11
  Version table:
     2.7.1+ds-3+b11 500
        500 buster/main amd64 Packages

The current release as of this writing is v2.26.0, hence the package from default Debian repos is a bit old.

Install Prometheus Using Pre-compiled Binaries on Debian 10

To ensure that you got the latest versions of Prometheus installed, you can use the pre-compiled binaries which can be downloaded directly from Prometheus downloads section.

Create Prometheus System User and Group

Before you can begin the installation, you have to create Prometheus system user and group as shown below;

useradd -M -r -s /bin/false prometheus

Create Prometheus Directories

Next, you need to create the directories that will be used to store Prometheus configurations files and other data.

mkdir /etc/prometheus /var/lib/prometheus

Download Prometheus Binary

Next, navigate to the downloads section and grab the latest version of Prometheus. You simply use wget to download it.


Install Prometheus on Debian 10

Once you have downloaded the binary, extract it and proceed to install it as follows.

tar xzf prometheus-$VER.linux-amd64.tar.gz

Next, copy the prometheus and promtool binaries under the extracted archive folder to /usr/local/bin directory.

cp prometheus-$VER.linux-amd64/{prometheus,promtool} /usr/local/bin/

After copying, set the user and group ownership of these binaries to prometheus.

chown prometheus:prometheus /usr/local/bin/{prometheus,promtool}

Next, copy the consoles and console_libraries directories to /etc/prometheus.

cp -r prometheus-$VER.linux-amd64/{consoles,console_libraries} /etc/prometheus/

Create Prometheus Configuration file

The default Prometheus configuration file is located on the extracted archive folder. For the demonstration purposes, we will just copy it to Prometheus configuration directory and modify it as follows;

cp prometheus-$VER.linux-amd64/prometheus.yml /etc/prometheus/
less /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']

In the default configuration there is a single job, called prometheus , which scrapes the time series data exposed by the Prometheus server. The job contains a single, statically configured, target, the localhost on port 9090.

Next, set the user and group ownership of Prometheus configuration directory, /etc/prometheus to prometheus.

chown -R prometheus:prometheus /etc/prometheus

Once that is done, similarly set the user and group ownership of Prometheus data directory, /var/lib/prometheus/ to prometheus.

chown -R prometheus:prometheus /var/lib/prometheus

Running Prometheus on Debian 10

At the very least, Prometheus is now set and is ready to run. However, at this point we do not have the Prometheus service configuration file and hence, we can run it in standalone mode by executing the command below;

prometheus --config.file=/etc/prometheus/prometheus.yml
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:380 msg="No time or size retention was set so using the default time retention" duration=15d
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:418 msg="Starting Prometheus" version="(version=2.26.0, branch=HEAD, revision=3cafc58827d1ebd1a67749f88be4218f0bab3d8d)"
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:423 build_context="(go=go1.16.2, [email protected], date=20210331-11:56:23)"
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:424 host_details="(Linux 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 debian (none))"
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:425 fd_limits="(soft=1024, hard=1048576)"
level=info ts=2021-04-04T06:10:29.876Z caller=main.go:426 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2021-04-04T06:10:29.878Z caller=web.go:540 component=web msg="Start listening for connections" address=
level=info ts=2021-04-04T06:10:29.878Z caller=main.go:795 msg="Starting TSDB ..."
level=info ts=2021-04-04T06:10:29.879Z caller=tls_config.go:191 component=web msg="TLS is disabled." http2=false
level=info ts=2021-04-04T06:10:29.881Z caller=head.go:696 component=tsdb msg="Replaying on-disk memory mappable chunks if any"
level=info ts=2021-04-04T06:10:29.881Z caller=head.go:710 component=tsdb msg="On-disk memory mappable chunks replay completed" duration=2.396µs
level=info ts=2021-04-04T06:10:29.881Z caller=head.go:716 component=tsdb msg="Replaying WAL, this may take a while"
level=info ts=2021-04-04T06:10:29.881Z caller=head.go:768 component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
level=info ts=2021-04-04T06:10:29.881Z caller=head.go:773 component=tsdb msg="WAL replay completed" checkpoint_replay_duration=16.322µs wal_replay_duration=122.019µs total_replay_duration=154.38µs
level=info ts=2021-04-04T06:10:29.882Z caller=main.go:815 fs_type=EXT4_SUPER_MAGIC
level=info ts=2021-04-04T06:10:29.882Z caller=main.go:818 msg="TSDB started"
level=info ts=2021-04-04T06:10:29.882Z caller=main.go:944 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
level=info ts=2021-04-04T06:10:29.883Z caller=main.go:975 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml totalDuration=917.073µs remote_storage=1.258µs web_handler=422ns query_engine=799ns scrape=685.906µs scrape_sd=23.984µs notify=13.096µs notify_sd=9.627µs rules=1.062µs
level=info ts=2021-04-04T06:10:29.883Z caller=main.go:767 msg="Server is ready to receive web requests."

Create Prometheus Systemd Service File

To be able to run prometheus as a service, you can create a systemd service configuration file as shown below;

cat > /etc/systemd/system/prometheus.service << 'EOL'
Description=Prometheus Time Series Collection and Processing Server

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


Next, reload systemd configuration files;

systemctl daemon-reload

Start and enable Prometheus to run on system boot.

systemctl enable --now  prometheus

To check the status of Prometheus service;

systemctl status prometheus
● prometheus.service - Prometheus Time Series Collection and Processing Server
   Loaded: loaded (/etc/systemd/system/prometheus.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-04-04 02:12:59 EDT; 6s ago
 Main PID: 916 (prometheus)
    Tasks: 7 (limit: 2359)
   Memory: 23.0M
   CGroup: /system.slice/prometheus.service
           └─916 /usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/etc/prometheus/con

Apr 04 02:12:59 debian prometheus[916]: level=info ts=2021-04-04T06:12:59.595Z caller=main.go:818 msg="TSDB started"
Apr 04 02:12:59 debian prometheus[916]: level=info ts=2021-04-04T06:12:59.595Z caller=main.go:944 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml
Apr 04 02:12:59 debian prometheus[916]: level=info ts=2021-04-04T06:12:59.595Z caller=main.go:975 msg="Completed loading of configuration file" filename=/etc/prometheus/pro
Apr 04 02:12:59 debian prometheus[916]: level=info ts=2021-04-04T06:12:59.595Z caller=main.go:767 msg="Server is ready to receive web requests."

Access Prometheus Web Interface

You can now access Prometheus using the address, http://<server_IP>:9090. This will take you to Prometheus’s built-in expression browser.

Install Prometheus on Debian 10

The scraped metrics can be viewed under, http://<server_IP>:9090/metrics.

Install Prometheus on Debian 10

To check the status of your node, navigate to Status > Targets.

Install Prometheus on Debian 10

Well, that is just about it on how to install Prometheus on Debian 10.

Want to learn how to monitor Linux hosts with Prometheus Node Exporter? Check the link below;

Integrate Prometheus with Grafana for Monitoring

Monitor Linux System Metrics with Prometheus Node Exporter

Monitoring Gitlab Metrics with Prometheus and Grafana

Monitor OpenVPN Connections with Prometheus and Grafana


Please enter your comment!
Please enter your name here