Loading...

How to Install Prometheus on Ubuntu 22.04

Simple.Predictable.Scalable

Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing Prometheus on Ubuntu 22.04

Prometheus is an open-source monitoring and alerting toolkit used to collect and analyze metrics from various systems. It is highly configurable and designed for reliability and scalability.

Step 1: Update System Packages

Before installing Prometheus, it's recommended to update the system packages to their latest versions:

sudo apt update
sudo apt upgrade -y

Step 2: Download and Extract Prometheus

Download the latest Prometheus release from the official website using the following commands:

cd ~
wget https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz
tar xvf prometheus-2.29.2.linux-amd64.tar.gz

Step 3: Configure Prometheus

Create a configuration file named prometheus.yml:

cd prometheus-2.29.2.linux-amd64
nano prometheus.yml

Enter the following configuration in the prometheus.yml file:

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

Step 4: Start Prometheus

Start the Prometheus server using the following command:

./prometheus --config.file=prometheus.yml

By default, Prometheus listens on port 9090.

Step 5: Access Prometheus Web Interface

Open a web browser and navigate to http://localhost:9090 to access the Prometheus web interface. From here, you can explore metrics, create graphs, and set up alerts.

Step 6: Set Up Prometheus as a Service

If you want Prometheus to run as a service, create a systemd service unit file:

sudo nano /etc/systemd/system/prometheus.service

Enter the following content into the prometheus.service file:

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml

[Install]
WantedBy=default.target

Save the file and exit the text editor.

Reload systemd and start the Prometheus service:

sudo systemctl daemon-reload
sudo systemctl start prometheus
sudo systemctl enable prometheus

Now Prometheus will automatically start on system boot.

Conclusion

You have successfully installed Prometheus on Ubuntu 22.04. You can now use Prometheus to monitor and analyze metrics from your systems.

Refer A Friend
Get $25

Installing Prometheus
Prometheus installation
Prometheus on Ubuntu 22.04
Ubuntu 22.04 Prometheus setup
Prometheus setup guide
Prometheus installation tutorial
How to install Prometheus on Ubuntu 22.04
Step-by-step Prometheus installation on Ubuntu 22.04
Prometheus setup on Ubuntu 22.04
Prometheus installer for Ubuntu 22.04

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.