Install and Validate Prometheus on Ubuntu 22.04
Install Prometheus on Ubuntu 22.04 with a small, testable configuration. Verify one scrape target and the actual alert path before extending monitoring to many hosts.
Choose a package source and scope
For Ubuntu 22.04, decide whether to use the distribution package or an upstream Prometheus release. Package versions, service files and default paths can differ. Record the installed version before applying examples from a different release.
For the distribution package, use an approved maintenance session:
sudo apt-get update
sudo apt-get install prometheus
systemctl status prometheus
Restrict network access to the monitoring service. Do not expose an unauthenticated metrics or administration endpoint directly to the internet. A remote browser’s localhost is its own computer, not the Ubuntu server.
Validate a minimal scrape configuration
Locate the configuration used by the installed service. Back it up and merge the required settings; do not paste multiple top-level scrape_configs keys into one YAML file. A minimal self-monitoring job looks like:
global:
scrape_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
Use the actual service path when checking configuration:
promtool check config /etc/prometheus/prometheus.yml
Apply only after validation, then inspect the service logs and Targets page. Add a node-exporter target only after installing and securing that exporter; a target on port 9100 does not create its own metrics source.
Verify queries before adding alerts
The built-in up metric helps check scrape success. Start with observed series and labels before writing alert expressions. The old node_cpu_usage example did not establish that such a metric existed in the configured exporter and has been removed.
Store alert rules in a file referenced by rule_files, validate with promtool check rules and test the alert path to Alertmanager and the final receiver. Restarting Prometheus without loading a rule file does not enable that alert.
Maintain the monitoring service
Choose retention and storage capacity deliberately, back up configuration and monitor Prometheus itself. Grafana and application instrumentation are separate installations; they do not appear automatically because the Prometheus service starts. Keep the initial deployment small enough to verify end to end before adding many targets.
Practical checks and next steps
Keep metrics endpoints restricted and monitor failed scrapes. An exporter, an alert rule and a delivered notification are three separate components to test.
Explore Linux & Ubuntu for related guides.
Reference 1 Reference 2 Reference 3
Content review: November 24, 2026. Reviewed the stated scope, guidance and source references; tenant, hardware and production changes were not executed as part of this editorial review. Original publication date retained.