How to install Prometheus on Debian 12

To Install Prometheus On Debian 12

Introduction:

Monitoring is a critical component of any production-grade infrastructure. Prometheus, an open-source monitoring solution, is widely used for its powerful querying language, efficient time series database, and seamless integration with a multitude of systems. This article guides you through the process of installing and configuring Prometheus on Debian 12, ensuring you have a solid monitoring foundation for your applications.

Installation Steps:

Step 1: Check the OS version by using the below command.

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Step 2: Update the System Packages by using the below command.

root@linuxhelp:~# apt update
Get:1 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Hit:2 http://deb.debian.org/debian bookworm InRelease                                 
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Fetched 48.0 kB in 1s (45.4 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
34 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3: Install Prometheus by using the below command.

root@linuxhelp:~# sudo apt install prometheus prometheus-node-exporter
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libc-ares2 libgrpc++1.51 libgrpc29 libprotoc32 libre2-9
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  fonts-glyphicons-halflings freeipmi-common ipmitool libfreeipmi17 libio-pty-perl
  libipc-run-perl libjs-bootstrap libjs-bootstrap4 libjs-d3
  libjs-eonasdan-bootstrap-datetimepicker libjs-jquery-hotkeys libjs-moment
  libjs-moment-timezone libjs-mustache libjs-popper.js libjs-rickshaw libjs-sizzle
  libnvme1 libopenipmi0 libtime-duration-perl moreutils node-jquery nvme-cli openipmi
  prometheus-node-exporter-collectors smartmontools uuid-runtime
Suggested packages:
  freeipmi-tools gsmartcontrol smart-notifier mailx | mailutils
The following NEW packages will be installed:
  fonts-glyphicons-halflings freeipmi-common ipmitool libfreeipmi17 libio-pty-perl
  libipc-run-perl libjs-bootstrap libjs-bootstrap4 libjs-d3
  libjs-eonasdan-bootstrap-datetimepicker libjs-jquery-hotkeys libjs-moment
  libjs-moment-timezone libjs-mustache libjs-popper.js libjs-rickshaw libjs-sizzle
  libnvme1 libopenipmi0 libtime-duration-perl moreutils node-jquery nvme-cli openipmi
  prometheus prometheus-node-exporter prometheus-node-exporter-collectors
  smartmontools uuid-runtime
0 upgraded, 29 newly installed, 0 to remove and 34 not upgraded.
Need to get 30.9 MB of archives.
After this operation, 362 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bookworm/main amd64 freeipmi-common all 1.6.10-1 [354 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 libfreeipmi17 amd64 1.6.10-1+b1 [1,036 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 ipmitool amd64 1.8.19-4 [439 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 libjs-jquery-hotkeys all 0~20130707+git2d51e3a9+dfsg-2.1 [11.5 kB]
Get:5 http://deb.debian.org/debian bookworm/main amd64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-3 [162 kB]
Get:6 http://deb.debian.org/debian bookworm/main amd64 libjs-popper.js all 1.16.1+ds-6 [52.4 kB]
Get:7 http://deb.debian.org/debian bookworm/main amd64 libjs-bootstrap4 all 4.6.1+dfsg1-4 [517 kB]
Get:8 http://deb.debian.org/debian bookworm/main amd64 libjs-bootstrap all 3.4.1+dfsg-3 [172 kB]
Get:9 http://deb.debian.org/debian bookworm/main amd64 libjs-moment all 2.29.4+ds-1 [155 kB]
Get:10 http://deb.debian.org/debian bookworm/main amd64 libjs-eonasdan-bootstrap-datetimepicker all 4.17.47-6 [27.5 kB]
Get:11 http://deb.debian.org/debian bookworm/main amd64 libjs-moment-timezone all 0.5.40+dfsg-1+2023c [1,257 kB]
Get:12 http://deb.debian.org/debian bookworm/main amd64 libjs-mustache all 3.0.1-1 [25.9 kB]
Get:13 http://deb.debian.org/debian bookworm/main amd64 libjs-d3 all 3.5.17-4 [132 kB]
Get:14 http://deb.debian.org/debian bookworm/main amd64 libjs-rickshaw all 1.5.1.dfsg-5 [710 kB]
Get:15 http://deb.debian.org/debian bookworm/main amd64 prometheus amd64 2.42.0+ds-5+b5 [19.3 MB]
Get:16 http://deb.debian.org/debian bookworm/main amd64 prometheus-node-exporter amd64 1.5.0-1+b6 [4,079 kB]
Get:17 http://deb.debian.org/debian bookworm/main amd64 uuid-runtime amd64 2.38.1-5+b1 [48.2 kB]
Get:18 http://deb.debian.org/debian bookworm/main amd64 libio-pty-perl amd64 1:1.17-1 [34.9 kB]
Get:19 http://deb.debian.org/debian bookworm/main amd64 libipc-run-perl all 20220807.0-1 [104 kB]
Get:20 http://deb.debian.org/debian bookworm/main amd64 libjs-sizzle all 2.3.6+ds+~2.3.3-2 [31.6 kB]
Get:21 http://deb.debian.org/debian bookworm/main amd64 libnvme1 amd64 1.3-1 [59.1 kB]
Get:22 http://deb.debian.org/debian bookworm/main amd64 libopenipmi0 amd64 2.0.33-1+b1 [551 kB]
Get:23 http://deb.debian.org/debian bookworm/main amd64 libtime-duration-perl all 1.21-2 [13.1 kB]
Get:24 http://deb.debian.org/debian bookworm/main amd64 moreutils amd64 0.67-1 [76.1 kB]
Get:25 http://deb.debian.org/debian bookworm/main amd64 node-jquery all 3.6.1+dfsg+~3.5.14-1 [160 kB]
Get:26 http://deb.debian.org/debian bookworm/main amd64 nvme-cli amd64 2.4+really2.3-3 [550 kB]
Get:27 http://deb.debian.org/debian bookworm/main amd64 openipmi amd64 2.0.33-1+b1 [248 kB]
Get:28 http://deb.debian.org/debian bookworm/main amd64 prometheus-node-exporter-collectors all 0.0~git20230203.6f710f8-1 [28.5 kB]
Get:29 http://deb.debian.org/debian bookworm/main amd64 smartmontools amd64 7.3-1+b1 [593 kB]
Fetched 30.9 MB in 5s (5,829 kB/s)      
Selecting previously unselected package freeipmi-common.
(Reading database ... 196520 files and directories currently installed.)
Preparing to unpack .../00-freeipmi-common_1.6.10-1_all.deb ...
Unpacking freeipmi-common (1.6.10-1) ...
Selecting previously unselected package libfreeipmi17.
Preparing to unpack .../01-libfreeipmi17_1.6.10-1+b1_amd64.deb ...
Unpacking libfreeipmi17 (1.6.10-1+b1) ...
Selecting previously unselected package ipmitool.
Preparing to unpack .../02-ipmitool_1.8.19-4_amd64.deb ...
Unpacking ipmitool (1.8.19-4) ...
Selecting previously unselected package libjs-jquery-hotkeys.
Preparing to unpack .../03-libjs-jquery-hotkeys_0~20130707+git2d51e3a9+dfsg-2.1_all.deb
 ...
Unpacking libjs-jquery-hotkeys (0~20130707+git2d51e3a9+dfsg-2.1) ...
Selecting previously unselected package fonts-glyphicons-halflings.
Preparing to unpack .../04-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-3_all.deb ...
Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ...
Selecting previously unselected package libjs-popper.js.
Preparing to unpack .../05-libjs-popper.js_1.16.1+ds-6_all.deb ...
Unpacking libjs-popper.js (1.16.1+ds-6) ...
Selecting previously unselected package libjs-bootstrap4.
Preparing to unpack .../06-libjs-bootstrap4_4.6.1+dfsg1-4_all.deb ...
Unpacking libjs-bootstrap4 (4.6.1+dfsg1-4) ...
Selecting previously unselected package libjs-bootstrap.
Preparing to unpack .../07-libjs-bootstrap_3.4.1+dfsg-3_all.deb ...
Unpacking libjs-bootstrap (3.4.1+dfsg-3) ...
Selecting previously unselected package libjs-moment.
Preparing to unpack .../08-libjs-moment_2.29.4+ds-1_all.deb ...
Unpacking libjs-moment (2.29.4+ds-1) ...
Selecting previously unselected package libjs-eonasdan-bootstrap-datetimepicker.
Preparing to unpack .../09-libjs-eonasdan-bootstrap-datetimepicker_4.17.47-6_all.deb ..
.
Unpacking libjs-eonasdan-bootstrap-datetimepicker (4.17.47-6) ...
Selecting previously unselected package libjs-moment-timezone.
Preparing to unpack .../10-libjs-moment-timezone_0.5.40+dfsg-1+2023c_all.deb ...
Unpacking libjs-moment-timezone (0.5.40+dfsg-1+2023c) ...
Selecting previously unselected package libjs-mustache.
Preparing to unpack .../11-libjs-mustache_3.0.1-1_all.deb ...
Unpacking libjs-mustache (3.0.1-1) ...
Selecting previously unselected package libjs-d3.
Preparing to unpack .../12-libjs-d3_3.5.17-4_all.deb ...
Unpacking libjs-d3 (3.5.17-4) ...
Selecting previously unselected package libjs-rickshaw.
Preparing to unpack .../13-libjs-rickshaw_1.5.1.dfsg-5_all.deb ...
Unpacking libjs-rickshaw (1.5.1.dfsg-5) ...
Selecting previously unselected package prometheus.
Preparing to unpack .../14-prometheus_2.42.0+ds-5+b5_amd64.deb ...
Unpacking prometheus (2.42.0+ds-5+b5) ...
Selecting previously unselected package prometheus-node-exporter.
Preparing to unpack .../15-prometheus-node-exporter_1.5.0-1+b6_amd64.deb ...
Unpacking prometheus-node-exporter (1.5.0-1+b6) ...
Selecting previously unselected package uuid-runtime.
Preparing to unpack .../16-uuid-runtime_2.38.1-5+b1_amd64.deb ...
Unpacking uuid-runtime (2.38.1-5+b1) ...
Selecting previously unselected package libio-pty-perl.
Preparing to unpack .../17-libio-pty-perl_1%3a1.17-1_amd64.deb ...
Unpacking libio-pty-perl (1:1.17-1) ...
Selecting previously unselected package libipc-run-perl.
Preparing to unpack .../18-libipc-run-perl_20220807.0-1_all.deb ...
Unpacking libipc-run-perl (20220807.0-1) ...
Selecting previously unselected package libjs-sizzle.
Preparing to unpack .../19-libjs-sizzle_2.3.6+ds+~2.3.3-2_all.deb ...
Unpacking libjs-sizzle (2.3.6+ds+~2.3.3-2) ...
Selecting previously unselected package libnvme1.
Preparing to unpack .../20-libnvme1_1.3-1_amd64.deb ...
Unpacking libnvme1 (1.3-1) ...
Selecting previously unselected package libopenipmi0.
Preparing to unpack .../21-libopenipmi0_2.0.33-1+b1_amd64.deb ...
Unpacking libopenipmi0 (2.0.33-1+b1) ...
Selecting previously unselected package libtime-duration-perl.
Preparing to unpack .../22-libtime-duration-perl_1.21-2_all.deb ...
Unpacking libtime-duration-perl (1.21-2) ...
Selecting previously unselected package moreutils.
Preparing to unpack .../23-moreutils_0.67-1_amd64.deb ...
Unpacking moreutils (0.67-1) ...
Selecting previously unselected package node-jquery.
Preparing to unpack .../24-node-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ...
Unpacking node-jquery (3.6.1+dfsg+~3.5.14-1) ...
Selecting previously unselected package nvme-cli.
Preparing to unpack .../25-nvme-cli_2.4+really2.3-3_amd64.deb ...
Unpacking nvme-cli (2.4+really2.3-3) ...
Selecting previously unselected package openipmi.
Preparing to unpack .../26-openipmi_2.0.33-1+b1_amd64.deb ...
Unpacking openipmi (2.0.33-1+b1) ...
Selecting previously unselected package prometheus-node-exporter-collectors.
Preparing to unpack .../27-prometheus-node-exporter-collectors_0.0~git20230203.6f710f8-
1_all.deb ...
Unpacking prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1) ...
Selecting previously unselected package smartmontools.
Preparing to unpack .../28-smartmontools_7.3-1+b1_amd64.deb ...
Unpacking smartmontools (7.3-1+b1) ...
Setting up smartmontools (7.3-1+b1) ...
Created symlink /etc/systemd/system/smartd.service ? /lib/systemd/system/smartmontools.
service.
Created symlink /etc/systemd/system/multi-user.target.wants/smartmontools.service ? /li
b/systemd/system/smartmontools.service.
Setting up libjs-popper.js (1.16.1+ds-6) ...
Setting up libio-pty-perl (1:1.17-1) ...
Setting up freeipmi-common (1.6.10-1) ...
Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ...
Setting up libjs-moment (2.29.4+ds-1) ...
Setting up libjs-sizzle (2.3.6+ds+~2.3.3-2) ...
Setting up prometheus-node-exporter (1.5.0-1+b6) ...
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus-node-exporter.se
rvice ? /lib/systemd/system/prometheus-node-exporter.service.
Setting up libjs-d3 (3.5.17-4) ...
Setting up libjs-moment-timezone (0.5.40+dfsg-1+2023c) ...
Setting up libipc-run-perl (20220807.0-1) ...
Setting up libtime-duration-perl (1.21-2) ...
Setting up libfreeipmi17 (1.6.10-1+b1) ...
Setting up uuid-runtime (2.38.1-5+b1) ...
Adding group `uuidd' (GID 126) ...
Done.
Created symlink /etc/systemd/system/sockets.target.wants/uuidd.socket ? /lib/systemd/sy
stem/uuidd.socket.
uuidd.service is a disabled or a static unit, not starting it.
Setting up libjs-bootstrap4 (4.6.1+dfsg1-4) ...
Setting up libjs-mustache (3.0.1-1) ...
Setting up libjs-jquery-hotkeys (0~20130707+git2d51e3a9+dfsg-2.1) ...
Setting up libopenipmi0 (2.0.33-1+b1) ...
Setting up libnvme1 (1.3-1) ...
Setting up ipmitool (1.8.19-4) ...
ipmievd.service is a disabled or a static unit, not starting it.
Setting up node-jquery (3.6.1+dfsg+~3.5.14-1) ...
Setting up libjs-bootstrap (3.4.1+dfsg-3) ...
Setting up libjs-eonasdan-bootstrap-datetimepicker (4.17.47-6) ...
Setting up nvme-cli (2.4+really2.3-3) ...
Created symlink /etc/systemd/system/default.target.wants/nvmefc-boot-connections.servic
e ? /lib/systemd/system/nvmefc-boot-connections.service.
Created symlink /etc/systemd/system/default.target.wants/nvmf-autoconnect.service ? /li
b/systemd/system/nvmf-autoconnect.service.
nvmf-connect.target is a disabled or a static unit, not starting it.
Setting up moreutils (0.67-1) ...
Setting up libjs-rickshaw (1.5.1.dfsg-5) ...
Setting up openipmi (2.0.33-1+b1) ...
Setting up prometheus-node-exporter-collectors (0.0~git20230203.6f710f8-1) ...
Created symlink /etc/systemd/system/timers.target.wants/prometheus-node-exporter-apt.ti
mer ? /lib/systemd/system/prometheus-node-exporter-apt.timer.
Created symlink /etc/systemd/system/timers.target.wants/prometheus-node-exporter-ipmito
ol-sensor.timer ? /lib/systemd/system/prometheus-node-exporter-ipmitool-sensor.timer.
Created symlink /etc/systemd/system/timers.target.wants/prometheus-node-exporter-mellan
ox-hca-temp.timer ? /lib/systemd/system/prometheus-node-exporter-mellanox-hca-temp.time
r.
Created symlink /etc/systemd/system/timers.target.wants/prometheus-node-exporter-nvme.t
imer ? /lib/systemd/system/prometheus-node-exporter-nvme.timer.
Created symlink /etc/systemd/system/timers.target.wants/prometheus-node-exporter-smartm
on.timer ? /lib/systemd/system/prometheus-node-exporter-smartmon.timer.
Setting up prometheus (2.42.0+ds-5+b5) ...
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service ? /lib/s
ystemd/system/prometheus.service.
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for fontconfig (2.14.1-4) ...
Processing triggers for libc-bin (2.36-9+deb12u3) ...

Step 4: Make the Configuration of Prometheus by using the below command.

root@linuxhelp:~# vim /etc/prometheus/prometheus.yml

Step 5: Restart the Prometheus by using the below command.

root@linuxhelp:~# systemctl restart prometheus

Step 6: Check the status Prometheus by using the below command.

root@linuxhelp:~# systemctl status prometheus
? prometheus.service - Monitoring system and time series database
     Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; preset: enabled)
     Active: active (running) since Wed 2024-03-20 05:26:03 IST; 9s ago
       Docs: https://prometheus.io/docs/introduction/overview/
             man:prometheus(1)
   Main PID: 8971 (prometheus)
      Tasks: 9 (limit: 3408)
     Memory: 28.4M
        CPU: 288ms
     CGroup: /system.slice/prometheus.service
             +-8971 /usr/bin/prometheus

Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.904Z caller=head.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.927Z caller=head.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.927Z caller=head.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.927Z caller=head.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.930Z caller=main.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.930Z caller=main.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.930Z caller=main.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.931Z caller=main.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.931Z caller=main.go>
Mar 20 05:26:03 linuxhelp prometheus[8971]: ts=2024-03-19T23:56:03.931Z caller=manager>

Step 7: Goto the Browser and Search the ip address with port number as shown in below image.

Step 8: The Prometheus Dashboard will shown as shown in below image.

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to to install Prometheus on Debian 12. Your feedback is much welcome.

FAQ
Q
What are the recommended resources for learning more about Prometheus?
A
To learn more about Prometheus, you can explore the official Prometheus documentation available on the Prometheus website. Additionally, there are many online tutorials, blogs, and community resources where you can find helpful guides, best practices, and troubleshooting tips. Joining the Prometheus community forums or attending meetups and conferences is also a great way to connect with other users and developers.
Q
How do I configure Prometheus to monitor my applications?
A
Prometheus uses a configuration file called prometheus.yml to define scrape targets and other settings. In this file, you specify the endpoints from which Prometheus should collect metrics. Typically, these are HTTP endpoints exposed by your applications. You can also define jobs, relabel configurations, and other options in the configuration file.
Q
Which package manager should I use to install Prometheus on Debian 12?
A
While you can manually download and install Prometheus from the official website, it's often more convenient to use a package manager. On Debian 12, you can use the apt package manager to install Prometheus if it's available in the Debian repositories. However, it's essential to check the version provided by the package manager, as it may not always be the latest version available.
Q
How do I install Prometheus on Debian 12?
A
To install Prometheus on Debian 12, you can follow these general steps:
First, download the Prometheus binary from the official Prometheus website or use a package manager if available.
Extract the downloaded archive to a directory of your choice.
Configure Prometheus by editing the prometheus.yml configuration file to define scrape targets and other settings.
Run Prometheus using the Prometheus executable. You can specify the configuration file using the --config.file flag.
Q
What is Prometheus?
A
Prometheus is an open-source monitoring and alerting toolkit originally built at SoundCloud. It is now a standalone open-source project and part of the Cloud Native Computing Foundation (CNCF). Prometheus collects metrics from configured targets at specified intervals, evaluates rule expressions, displays the results, and can trigger alerts if specified conditions are observed.