How to Install Prometheus on Ubuntu 22.04 LTS

Step-by-step instructions on how to install Prometheus, the popular open-source monitoring and alerting toolkit, on Ubuntu 22.04 LTS. Enhance your system monitoring capabilities with Prometheus and ensure optimal performance.

Welcome to this comprehensive guide on installing Prometheus, a popular open-source monitoring and alerting toolkit, on the Ubuntu 22.04 LTS operating system. In this article, we will walk you through the step-by-step process of setting up Prometheus, configuring it to monitor your systems, and leveraging its powerful features to gain valuable insights into your infrastructure’s health.


Before we begin, ensure that you have the following prerequisites in place:

  • A server running Ubuntu 22.04 LTS.
  • Root or sudo access to the server.
  • Basic knowledge of the Linux command line.

Now, let’s dive into the installation process.

Step 1: Update System Packages

Before proceeding with any installation, it is essential to update the system packages to ensure you have the latest versions. Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install and Configure Prometheus

To install Prometheus on Ubuntu 22.04 LTS, follow these steps:

  1. Download the latest version of Prometheus using the wget command:
  1. Extract the downloaded archive using the tar command:
tar xvfz prometheus-2.30.3.linux-amd64.tar.gz
  1. Move into the extracted directory:
cd prometheus-2.30.3.linux-amd64
  1. Start Prometheus using the following command:
./prometheus --config.file=prometheus.yml

Step 3: Configure Prometheus Targets

Prometheus monitors various targets, such as servers, applications, and services. To configure the targets, follow these steps:

  1. Open the Prometheus configuration file:
nano prometheus.yml
  1. Add the target configurations under the scrape_configs section. For example:
  - job_name: 'node_exporter'
      - targets: ['localhost:9100']
  1. Save and close the file.

Step 4: Explore Prometheus Web Interface

Prometheus provides a web-based user interface for monitoring and querying the collected metrics. To access the web interface, follow these steps:

  1. Open your preferred web browser.
  2. Enter the following URL in the address bar: http://<your_server_ip>:9090

You will now be able to explore the Prometheus web interface and perform various monitoring tasks.

Step 5: Set Up Alerting with Prometheus

Prometheus allows you to set up alerting rules based on predefined conditions. To configure alerting, follow these steps:

  1. Open the Prometheus configuration file:
nano prometheus.yml
  1. Add alerting rules under the rule_files section. For example:
  - alerts.rules.yml
  1. Create a new file named alerts.rules.yml and define your alerting rules:
- name: example
  - alert: HighCpuUsage
    expr: node_cpu_usage > 80
    for: 5m
      severity: critical
      summary: High CPU Usage Detected
      description: "CPU usage is above 80% for more than 5 minutes."
  1. Save and close both files.

Step 6: Secure Prometheus with SSL

To secure the Prometheus web interface with SSL, follow these steps:

  1. Generate an SSL certificate and private key.
  2. Configure Prometheus to use the SSL certificate and key.

For detailed instructions on securing Prometheus with SSL, refer to the official documentation.


Congratulations! You have successfully installed and configured Prometheus on Ubuntu 22.04 LTS. You can now monitor your systems, create custom dashboards, set up alerting, and gain valuable insights into your infrastructure’s performance.

Remember to regularly update Prometheus and explore its vast ecosystem of exporters, integrations, and community-supported plugins to enhance your monitoring capabilities.

Must Read

Related Articles