How to install Prometheus on Ubuntu 24.04 (step-by-step, 2026)
A clean production-style Prometheus install on Ubuntu 24.04: dedicated user, systemd unit, retention flags, config validation with promtool, and the firewall step most guides skip. Current for Prometheus 3.x - including what changed since the 2.x tutorials you'll find elsewhere.
The AlertKick team
Installing Prometheus on Ubuntu 24.04 takes about ten minutes: download the official tarball, create a system user, write a systemd unit, validate the config, start it. This guide does it the production way - not apt install prometheus, which ships a version years behind upstream - and it is written for Prometheus 3.x, which quietly broke every 2.x-era tutorial still ranking in search (more on that below).
1. Download and unpack
Grab the current Linux amd64 tarball from prometheus.io/download - substitute the latest version for 3.13.1 below:
cd /tmp
curl -LO https://github.com/prometheus/prometheus/releases/download/v3.13.1/prometheus-3.13.1.linux-amd64.tar.gz
tar xvf prometheus-3.13.1.linux-amd64.tar.gz
cd prometheus-3.13.1.linux-amd64
The tarball contains the prometheus server, promtool (the config linter you will use in step 4), and a sample config. If you read older guides mentioning consoles/ and console_libraries/ directories: they were removed in Prometheus 3.0. Their absence is normal.
2. User, directories, binaries
Run Prometheus as its own unprivileged system user, never root:
sudo useradd --system --no-create-home --shell /usr/sbin/nologin prometheus
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo cp prometheus promtool /usr/local/bin/
sudo cp prometheus.yml /etc/prometheus/
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
/etc/prometheus holds config, /var/lib/prometheus holds the time-series database.
3. Configuration
The shipped prometheus.yml is nearly usable as-is. A minimal honest starting point:
# /etc/prometheus/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
That one job scrapes Prometheus itself, which proves the pipeline works. Real targets come next - typically node_exporter for Linux host metrics, added as another entry under scrape_configs.
4. Validate before you start
promtool catches config mistakes before they take the service down - make it a habit now, because later you will be editing alert rules at speed:
promtool check config /etc/prometheus/prometheus.yml
Checking /etc/prometheus/prometheus.yml
SUCCESS: /etc/prometheus/prometheus.yml is valid prometheus config file syntax
5. The systemd unit
# /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
Restart=on-failure
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/var/lib/prometheus \
--storage.tsdb.retention.time=30d \
--web.listen-address=127.0.0.1:9090
[Install]
WantedBy=multi-user.target
Two deliberate choices worth keeping:
--storage.tsdb.retention.time=30d- the default is 15 days; be explicit either way, and add--storage.tsdb.retention.size(for example20GB) if the disk is small. Prometheus fills disks quietly and a full disk takes the monitoring down with everything else.--web.listen-address=127.0.0.1:9090- Prometheus has no authentication by default, and its UI exposes every metric plus the config (minus secrets). Binding to localhost keeps it private; front it with a reverse proxy that does auth, or an SSH tunnel (ssh -L 9090:localhost:9090 yourserver), if you need remote access. If it must listen on0.0.0.0, firewall it to trusted sources:sudo ufw allow from 10.0.0.0/8 to any port 9090 proto tcp- never a bareallow 9090.
Enable and start:
sudo systemctl daemon-reload
sudo systemctl enable --now prometheus
6. Verify
systemctl status prometheus --no-pager
curl -s localhost:9090/-/healthy
● prometheus.service - Prometheus
Active: active (running)
Prometheus Server is Healthy.
Open the UI (via tunnel or proxy) at http://localhost:9090, run the query up - it should return 1 for the self-scrape target. From here, Status -> Targets shows scrape health for everything you add.
Where to go next
A Prometheus server scraping itself is a proof of concept. The working stack is a short series:
- Node exporter setup - actual Linux host metrics: CPU, memory, disk, network.
- Alert rules worth copying - the 15 rules that catch real incidents (disk-fill prediction, OOM kills, CPU steal).
- Alertmanager setup - turning firing rules into deduplicated, routed notifications.
One honest boundary to plan around: Prometheus watches your servers from inside the network, which means it cannot tell you the things an outside observer sees - the site being down from the internet, the SSL certificate expiring, the domain lapsing, or the fact that Prometheus itself died (a monitor cannot alert on its own absence). The standard pairing is external checks alongside the internal stack: AlertKick’s uptime and SSL monitors plus a heartbeat on the Prometheus host cover that outside half on the free plan, escalation and on-call included.
Frequently asked questions
- What is the latest version of Prometheus?
- As of July 2026 the current release line is Prometheus 3.13 (an LTS line). Check prometheus.io/download for the exact latest patch release and substitute it into the commands - the install steps do not change between patch versions.
- Should I install Prometheus from apt or from the official tarball?
- Use the official tarball. Ubuntu's prometheus package lags far behind upstream and still ships a 2.x version on many releases. The tarball install is five commands and gives you current features, current security fixes, and documentation that matches what is running.
- Why does my Prometheus systemd unit fail with an error about consoles?
- You copied flags from a Prometheus 2.x tutorial. The consoles and console_libraries directories were removed in Prometheus 3.0, so --web.console.templates and --web.console.libraries no longer exist. Delete those two flags from the unit file and it will start.
- How much disk does Prometheus need?
- Roughly 1-2 bytes per sample on disk. A single server scraping node_exporter every 15 seconds generates on the order of tens of MB per day - set --storage.tsdb.retention.time (and optionally retention.size) to match your disk, and monitor the filesystem it writes to like any other disk.