Installing Prometheus on Ubuntu – Complete Guide


When it comes to monitoring systems and keeping track of performance metrics, Prometheus has quickly become one of the most trusted tools out there. The best part is that it is open source and flexible, making it a favorite among developers and sysadmins alike. Now, if you are running Ubuntu, you might be wondering how to set everything up without running into roadblocks. The good news is that the process of Prometheus Ubuntu install is far less complicated than it looks at first glance. With the right steps, you can have it up and running smoothly in under an hour. In this guide, we will walk through everything you need to know, from installation to configuration. By the end, you will have a fully functional monitoring system ready to collect metrics and help you stay ahead of issues. So grab a coffee, and let us dive right in.

Why Choose Prometheus for Ubuntu

Here is the thing. You could try other monitoring solutions, but Prometheus stands out for its speed, efficiency, and ecosystem. It was designed for time series data, meaning it stores metrics in a way that makes queries fast and reliable. On top of that, it integrates beautifully with tools like Grafana, Kubernetes, and alert managers. Running it on Ubuntu just makes sense because Ubuntu is lightweight, stable, and perfect for servers.

Prerequisites Before Installation

Before we jump into commands, let us make sure you have everything ready. You will need:

  • A machine running Ubuntu 20.04 or newer

  • A non root user with sudo privileges

  • Basic knowledge of Linux commands

Once you check these boxes, you are good to move forward.

Step 1 Update Your Ubuntu System

You ever noticed how many problems disappear after updating your system first The same applies here. Run the following commands to get everything up to date:

sudo apt update
sudo apt upgrade -y

This ensures you have the latest packages and no hidden compatibility issues.

Step 2 Create a Prometheus User

It is always a good practice to create a dedicated system user for Prometheus. This keeps permissions clean and adds a layer of security.

sudo useradd --no-create-home --shell /bin/false prometheus

Step 3 Download and Extract Prometheus

Head to the official Prometheus release page and grab the latest version. For now, let us assume you are downloading the tarball directly with wget.

wget https://github.com/prometheus/prometheus/releases/latest/download/prometheus-linux-amd64.tar.gz
tar -xvzf prometheus-linux-amd64.tar.gz
cd prometheus-*

Once extracted, move the binaries to the appropriate directory:

sudo mv prometheus /usr/local/bin/
sudo mv promtool /usr/local/bin/

Step 4 Set Up Directories

Create directories for configuration files and data storage.

sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus

Then move configuration files:

sudo mv consoles /etc/prometheus
sudo mv console_libraries /etc/prometheus
sudo mv prometheus.yml /etc/prometheus

Step 5 Configure Prometheus

Now open the main configuration file:

sudo nano /etc/prometheus/prometheus.yml

Inside, you will find a default scrape job for Prometheus itself. You can add more targets here later, like Node Exporter or custom apps.

Step 6 Create a Systemd Service

This is where the setup becomes professional. Create a new service file:

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

Add the following:

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus/

[Install]
WantedBy=multi-user.target

Save and exit, then reload systemd:

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

Step 7 Verify Installation

Once started, Prometheus should be accessible at:

http://localhost:9090

Open this in your browser and you should see the Prometheus dashboard. If it loads, congrats, your Prometheus Ubuntu install is successful.

Adding Node Exporter

Let us be honest, monitoring only Prometheus is not super useful. You will probably want system metrics like CPU, memory, and disk usage. That is where Node Exporter comes in.

Download and install it:

wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-linux-amd64.tar.gz
tar -xvzf node_exporter-linux-amd64.tar.gz
cd node_exporter-*
sudo mv node_exporter /usr/local/bin/

Create a systemd service just like Prometheus, then start and enable it. Finally, update your prometheus.yml file to scrape Node Exporter.

Common Troubleshooting Tips

  • If Prometheus does not start, check logs with journalctl -u prometheus

  • Make sure ports are open if you are running it on a server

  • Always double check file permissions if something looks off

Final Thoughts on Prometheus Ubuntu Install

Setting up Prometheus on Ubuntu might sound intimidating at first, but once you break it down into steps, it feels pretty straightforward. The tool itself is powerful, but the beauty lies in how you can extend it with exporters, integrate it with Grafana, and automate alerts. With this setup in place, you will not just be reacting to problems, you will be predicting them. So take this guide, try it out, and give yourself the peace of mind that comes from proper monitoring.

Sources: Prometheus.io, Ubuntu.com, Grafana.com

Comments

Popular posts from this blog

Linux Immutable Distros Explained Simply

AI Linux Distro Revolution in 2025

Linux Gaming Performance Tips That Work