How to Install Prometheus on Ubuntu 26.04
Prometheus is an open-source monitoring and alerting toolkit that has become the de facto standard for observability in cloud-native and containerized environments. It actively scrapes data from target endpoints (e.g., servers and web apps) via HTTP GET requests at set time intervals, unlike many older tools (Nagios, Zabbix) that rely on agents to push data to a central server.
Prometheus uses PromQL, a powerful and flexible query language, to query, aggregate, and analyze data collected from target endpoints. The data is then used to create graphs and trigger alerts when a target goes down, or its metrics exceed a configured threshold.
Prometheus is focused on metrics, not logs or traces. It typically tracks the following metrics:
- System metrics (e.g., CPU, memory, disk I/O, network usage, etc)
- Application metrics (e.g., error rates, latency histograms, request counts)
- Kubernetes metrics (e.g., deployment health, pod status, and resource requests)
- Databases, message queues, load balancers, etc., via community exporters (e.g., mongodb_exporter, redis_exporter, kafka_exporter)
This tutorial explores how to install Prometheus on Ubuntu 26.04 LTS.
#Prerequisites
To get started with installing Prometheus, ensure you have the following.
-
A fresh instance of Ubuntu 26.04 with SSH access. You can deploy a high-performance and scalable cloud VPS on Cherry Servers to follow the steps outlined
-
A sudo user configured on the instance
Scalable VPS Hosting
Deploy fast, secure VPS for websites, apps, and dev environments. Scale on demand, manage with full root access, and get 24/7 expert support.
#Installing Prometheus on Ubuntu 26.04
This guide sets up Prometheus as the core monitoring and time-series database. It then illustrates how to install Node Exporter to expose OS-level and hardware metrics to Prometheus. Towards the end, you will also learn how to set up alerting rules and configure AlertManager to send alerts.
#Step 1: Update the system
First, update the local package index.
sudo apt update
This refreshes the local database of available software packages and their versions, preventing errors such as ‘missing packages’ when installing software.
Once updated, head over to the next step.
#Step 2: Create Prometheus user and group
First, create a dedicated group called prometheus using the groupadd command.
sudo groupadd --system prometheus
Next, create a dedicated user called prometheusand add the user to the newly created prometheus group.
sudo useradd --no-create-home --shell /sbin/nologin --system -g prometheus prometheus
#Step 3: Create directories for storing Prometheus data
Now, let's give Prometheus data and configuration files proper directories. First up, we'll carve out a space in /etc to house the configuration file.
sudo mkdir /etc/prometheus
Next, create the data storage directory for all Prometheus data in the /var/lib path.
sudo mkdir /var/lib/prometheus
Assign the correct permissions to the directories
sudo chown prometheus:prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
#Step 4: Download Prometheus and install binaries
At the time of writing, the latest release is 3.13.1. By the time you're reading this, a newer version may be out, so always double-check and swap in the current release.
To download the binary, run:
curl -LO https://github.com/prometheus/prometheus/releases/download/v3.13.1/prometheus-3.13.1.linux-amd64.tar.gz
Extract the archive:
tar xvf prometheus-3.13.1.linux-amd64.tar.gz
Next, navigate into the directory:
cd prometheus-3.13.1.linux-amd64
Copy the prometheus (server) and promtool (config validation/query tool) binaries to the /usr/local/bin path.
sudo cp prometheus /usr/local/bin/
sudo cp promtool /usr/local/bin/
Next, assign ownership to the prometheus user:
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
Starting with Prometheus 3.0, the old "consoles" web UI feature was dropped. Consequently, the consoles and console_libraries directories are no longer shipped in the release tarball at all.
This happened for the following reasons.
-
The
consolesand/console_librariestemplates were an old, mostly-unmaintained feature for building simple server-side dashboards directly in Prometheus. Both the templates directory and library directory had to be pointed to explicitly via--web.console.templatesand--web.console.librariesfor the feature to work at all. This approach had a long history of not working cleanly out of the box. -
Grafana has since become the de facto standard for building and viewing dashboards, making this built-in alternative largely redundant for most users.
#Step 5: Create a Prometheus configuration file
Next, create a /etc/prometheus/prometheus.yml file with a minimal configuration that scrapes Prometheus's own metrics:
sudo tee /etc/prometheus/prometheus.yml > /dev/null <<'EOF'
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
EOF
Assign the right ownership to the configuration file.
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml
#Step 6: Create a systemd configuration
To ensure Prometheus starts automatically and can easily be managed as a background service using systemd commands, create a systemd unit file:
sudo tee /etc/systemd/system/prometheus.service > /dev/null <<'EOF'
[Unit]
Description=Prometheus Monitoring System
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus/ \
--web.listen-address=0.0.0.0:9090
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
To apply the new configuration, reload the systemd manager and then enable the service to launch at boot while starting it immediately:
sudo systemctl daemon-reload
sudo systemctl enable --now prometheus
Next, verify that the monitoring system is running without issues by checking its status:
sudo systemctl status prometheus
If you need to confirm the integrity of your YAML settings, use the promtool binary to validate the configuration file:
promtool check config /etc/prometheus/prometheus.yml
You should get the following output if everything looks good.
OutputChecking /etc/prometheus/prometheus.yml
SUCCESS: /etc/prometheus/prometheus.yml is valid prometheus config file syntax
Finally, access the web-based interface by navigating to http://your_server_ip:9090 in your preferred browser.
To verify the endpoint health, visit http://your_server_ip:9090/targets.
#Step 7: Add Node Exporter for System Metrics (Optional but Recommended)
Out of the box, Prometheus only scrapes and stores metrics about its own internal operations. This includes factors like scrape duration, target availability, resource usage, and query performance. While useful for debugging Prometheus itself, it doesn't provide any meaningful insights about the server: disk space, memory utilization, network throughput, and CPU usage, to mention a few. It has no built-in way to read that host-level data. It can only scrape metrics that something exposes over HTTP in its expected format.
Node Exporter is that "something". It's a lightweight agent that exposes a Linux server's hardware and OS metrics for Prometheus to scrape. It acts as a bridge between your server's raw system statistics and Prometheus. As the name implies, it exports OS/hardware statistics to Prometheus.
Therefore, to derive any valuable information from your server, it’s essential to install Node Exporter.
As of July 14, 2026, the latest stable version of Prometheus Node Exporter is 1.12.1. To install it, first download the binary from its GitHub page.
cd ~
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.12.1/node_exporter-1.12.1.linux-amd64.tar.gz
Next, extract the tarball file.
tar xvf node_exporter-1.12.1.linux-amd64.tar.gz
Next, copy the node_exporter binary to the /usr/local/bin path.
sudo cp node_exporter-1.12.1.linux-amd64/node_exporter /usr/local/bin/
Then create a systemd file for it.
sudo tee /etc/systemd/system/node_exporter.service > /dev/null <<'EOF'
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
EOF
Reload systemd and enable the Node Exporter service to start on boot.
sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter
Verify that the Node Exporter systemd service is running:
sudo systemctl status node_exporter
Output● node_exporter.service - Node Exporter
Loaded: loaded (/etc/systemd/system/node_exporter.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-07-16 14:51:23 EEST; 2 days ago
Main PID: 3709 (node_exporter)
Tasks: 4 (limit: 2315)
Memory: 4.4M (peak: 7.3M)
CPU: 5.316s
CGroup: /system.slice/node_exporter.service
└─3709 /usr/local/bin/node_exporter
Then add it as a scrape target in /etc/prometheus/prometheus.yml:
yaml - job_name: "my-node-1"
static_configs:
- targets: ["localhost:9100"]
Restart Prometheus to pick up the change:
sudo systemctl restart prometheus
Upon refreshing the targets interface, you will now notice an additional endpoint for Node Exporter.
#Step 9: Configuring alert rules
Configuring alerting rules in Prometheus turns it from a passive metrics store into an active monitoring system. Instead of waiting for someone to notice a slow app or check a dashboard, Prometheus continuously evaluates your metrics and flags problems the moment a threshold is crossed; often before users are even affected.
The first step in configuring alert rules is to create a designated directory for the rules.
sudo mkdir -p /etc/prometheus/rules
Grant ownership of the directory to the prometheus user and group.
sudo chown prometheus:prometheus /etc/prometheus/rules
Next, create an alerts YAML file and specify the alerts as shown.
sudo tee /etc/prometheus/rules/node_alerts.yml > /dev/null <<'EOF'
groups:
- name: node_alerts
rules:
- alert: HighCPUUsage
expr: 100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 90
for: 5m
labels:
severity: warning
annotations:
summary: "High CPU usage on {{ $labels.instance }}"
description: "CPU usage is above 90% for more than 5 minutes (current value: {{ $value | printf \"%.2f\" }}%)."
- alert: HighMemoryUsage
expr: (1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100 > 90
for: 5m
labels:
severity: warning
annotations:
summary: "High memory usage on {{ $labels.instance }}"
description: "Memory usage is above 90% for more than 5 minutes."
- alert: LowDiskSpace
expr: (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay"}) * 100 < 10
for: 10m
labels:
severity: critical
annotations:
summary: "Low disk space on {{ $labels.instance }}"
description: "Filesystem {{ $labels.mountpoint }} has less than 10% space remaining."
- alert: InstanceDown
expr: up == 0
for: 2m
labels:
severity: critical
annotations:
summary: "Instance {{ $labels.instance }} is down"
description: "{{ $labels.instance }} has been unreachable for more than 2 minutes."
EOF
The above file defines four host-monitoring rules based on node_exporter metrics:
-
HighCPUUsage: Fires an alert when average CPU usage exceeds 90% for 5+ minutes. Severity: warning.
-
HighMemoryUsage: Triggers an alert when memory usage exceeds 90% for 5+ minutes. Severity: warning.
-
LowDiskSpace: Sends an alert when available disk space drops below 10% (excluding tmpfs/overlay filesystems) for 10+ minutes. Severity: critical.
-
InstanceDown: Sends an alert when Prometheus can't scrape a target (up == 0) for 2+ minutes, meaning the host or exporter is unreachable. Severity: critical.
Be sure to grant ownership of the node_alerts.yml to the prometheus user and group.
sudo chown prometheus:prometheus /etc/prometheus/rules/node_alerts.yml
Next, update the /etc/prometheus/prometheus.yml file and add a rule_files section:
rule_files:
- "rules/*.yml"
The configuration file should now look as shown:
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "my-node-1"
static_configs:
- targets: ["localhost:9100"]
rule_files:
- "rules/*.yml"
Always validate the rule syntax before restarting Prometheus.
promtool check rules /etc/prometheus/rules/node_alerts.yml
You should get the following output, indicating that all looks good.
OutputChecking /etc/prometheus/rules/node_alerts.yml
SUCCESS: 4 rules found
You can now proceed to restart Prometheus to effect the changes.
sudo systemctl restart prometheus
#Step 10: Install and configure AlertManager
Installing AlertManager follows the same pattern as installing Prometheus. It entails creating a dedicated system user and group, creating dedicated directories for storing configuration files and data, and lastly downloading and installing the binary.
Start by creating a system group and a user. Then add the user to the group.
sudo groupadd --system alertmanager
sudo useradd --no-create-home --shell /sbin/nologin --system -g alertmanager alertmanager
Next, create directories to store the configuration file and alert data.
sudo mkdir -p /etc/alertmanager /var/lib/alertmanager
Assign directory permissions.
sudo chown -R alertmanager:alertmanager /etc/alertmanager
sudo chown -R alertmanager:alertmanager /var/lib/alertmanager
Next, download and extract the Alertmanager archive.
curl -LO https://github.com/prometheus/alertmanager/releases/download/v0.28.1/alertmanager-0.28.1.linux-amd64.tar.gz
tar xvf alertmanager-0.28.1.linux-amd64.tar.gz
cd alertmanager-0.28.1.linux-amd64
Copy the binaries and assign the directory permissions.
sudo cp alertmanager /usr/local/bin/
sudo cp amtool /usr/local/bin/
sudo chown alertmanager:alertmanager /usr/local/bin/alertmanager /usr/local/bin/amtool
Next, create an Alertmanager configuration file.
sudo tee /etc/alertmanager/alertmanager.yml > /dev/null <<'EOF'
route:
receiver: "default"
group_by: ["alertname", "instance"]
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
receivers:
- name: "default"
email_configs:
- to: "you@example.com"
from: "alertmanager@example.com"
smarthost: "smtp.example.com:587"
auth_username: "alertmanager@example.com"
auth_password: "your-smtp-password"
send_resolved: true
EOF
Next, create a systemd service file.
sudo tee /etc/systemd/system/alertmanager.service > /dev/null <<'EOF'
[Unit]
Description=Alertmanager
Wants=network-online.target
After=network-online.target
[Service]
User=alertmanager
Group=alertmanager
Type=simple
ExecStart=/usr/local/bin/alertmanager \
--config.file=/etc/alertmanager/alertmanager.yml \
--storage.path=/var/lib/alertmanager/
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
Reload systemd and enable the Alertmanager service.
sudo systemctl daemon-reload
sudo systemctl enable --now alertmanager
Be sure to update the Prometheus configuration file with the following lines. This tells Prometheus where to find Alertmanager.
alerting:
alertmanagers:
- static_configs:
- targets: ["localhost:9093"]
Finally, restart Prometheus for all the changes to take effect.
sudo systemctl restart prometheus
To trigger an alert, temporarily lower a threshold in your rules. For demonstration, we will simulate downtime by temporarily stopping the Node Exporter, which will trigger the InstanceDown alert. You can confirm this from a web browser by heading to http://your_server_ip:9090/alerts.
Alternatively, you can view logs in real time using the tail -f command as shown:
tail -f /var/log/syslog | grep -i InstanceDown
Here’s some sample log output confirming an alert was triggered.
Output2026-07-22T15:11:49.878970+03:00 ubuntu-server alertmanager[7333]: time=2026-07-22T12:11:49.878Z level=WARN source=notify.go:866 msg="Notify attempt failed, will retry later" component=dispatcher receiver=default integration=email[0] aggrGroup="{}:{alertname=\"InstanceDown\", instance=\"localhost:9100\"}"
#Conclusion
By following the steps in this guide, you now have a fully functioning Prometheus monitoring stack running on Ubuntu 26.04 LTS. Starting from a dedicated system user and a clean systemd service, you've installed Prometheus itself, extended it with the Node Exporter to capture host-level metrics like CPU, memory, and disk usage, and layered alerting rules on top to ensure problems don't go unnoticed. With Alertmanager wired in, those alerts now translate into real notifications, whether by email or another channel of your choice.
From here, most of the work is tuning the system to your specific needs rather than building it from scratch. Additionally, you'll likely want to build out Grafana dashboards to provide a more visual view of your metrics.
Starting at just $3.51 / month, get virtual servers with top-tier performance.



