Skip to content

Step-by-step guide to install and configure Prometheus on Ubuntu/Debian for system monitoring and observability.

Notifications You must be signed in to change notification settings

M-Tayyab06/Prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Prometheus Setup Guide (Ubuntu/Debian)

License Stars Issues PRs Welcome Ubuntu Monitoring

πŸš€ Prometheus Installation on Ubuntu

Welcome! This guide will walk you through installing and running Prometheus on an Ubuntu system step-by-step.


πŸ› οΈ Requirements

  • Ubuntu 20.04+ system
  • Terminal access with sudo privileges

βš™οΈ Step-by-Step Setup

πŸ”„ 1. Update the System

Keep your system packages up to date:

sudo apt update && sudo apt upgrade -y

πŸ‘€ 2. Create Prometheus User

Create a dedicated system user for Prometheus:

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

πŸ“₯ 3. Download Prometheus

Download the latest release from GitHub:

wget https://github.com/prometheus/prometheus/releases/download/v2.51.2/prometheus-2.51.2.linux-amd64.tar.gz

tar xvf prometheus-2.51.2.linux-amd64.tar.gz
cd prometheus-2.51.2.linux-amd64

πŸ“‚ 4. Move Binaries

Move the main binaries to your system PATH:

sudo cp prometheus /usr/local/bin/
sudo cp promtool /usr/local/bin/

πŸ—‚οΈ 5. Setup Directories

Create required directories and copy configuration:

sudo mkdir -p /etc/prometheus
sudo mkdir -p /var/lib/prometheus
sudo cp -r consoles /etc/prometheus
sudo cp -r console_libraries /etc/prometheus
sudo cp prometheus.yml /etc/prometheus/

Set proper ownership:

sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus

πŸ”§ 6. Create Systemd Service

Create the systemd service file:

sudo tee /etc/systemd/system/prometheus.service<<EOF

Paste this configuration:

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

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
  --config.file=/etc/prometheus/prometheus.yml \
  --storage.tsdb.path=/var/lib/prometheus/ \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries

[Install]
WantedBy=multi-user.target

🟒 7. Start & Enable Prometheus

sudo systemctl daemon-reexec
sudo systemctl enable prometheus
sudo systemctl start prometheus

Check status:

sudo systemctl status prometheus

🌐 8. Verify Installation

Open your browser and navigate to:

http://localhost:9090
OR
http://your_public_ip:9090

You should see the Prometheus Dashboard. image


βœ… Next Steps

πŸ”Έ Install Node Exporter to monitor system metrics
πŸ”Έ Integrate with Grafana for visual dashboards
πŸ”Έ Define alerting rules in prometheus.yml


πŸ“ Directory Structure

/etc/prometheus/
β”œβ”€β”€ prometheus.yml
β”œβ”€β”€ consoles/
└── console_libraries/