Skip to main content

Observability with prometheus (installation)

 

How to Install Prometheus 3.0: A Beginner-Friendly Guide

Prometheus 3.0 is a robust tool for monitoring and alerting, providing insights into your system's performance. Here's a step-by-step guide to help you install and set up Prometheus on a Linux-based server.


Step 1: Prepare Your Environment

  1. Update Your System Make sure your system is up-to-date:

    sudo apt update && sudo apt upgrade -y
  2. Install Required Tools Ensure you have wget or curl installed to download Prometheus:

    sudo apt install wget curl -y

Step 2: Download Prometheus 3.0

  1. Visit the official Prometheus downloads page. Alternatively, you can use wget to download the binary directly:

    wget https://github.com/prometheus/prometheus/releases/download/v3.0.0/prometheus-3.0.0.linux-amd64.tar.gz
  2. Extract the downloaded file:

    tar -xvzf prometheus-3.0.0.linux-amd64.tar.gz cd prometheus-3.0.0.linux-amd64

Step 3: Move Prometheus to a Suitable Location

  1. Move Prometheus and its files to /usr/local/bin/:

    sudo mv prometheus /usr/local/bin/ sudo mv promtool /usr/local/bin/
  2. Move the default configuration and libraries to /etc/prometheus:

    sudo mkdir /etc/prometheus sudo mv prometheus.yml /etc/prometheus/

Step 4: Create a Prometheus User

To enhance security, run Prometheus under a dedicated user:

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

Update ownership of Prometheus directories:

sudo chown -R prometheus:prometheus /etc/prometheus sudo chown prometheus:prometheus /usr/local/bin/prometheus sudo chown prometheus:prometheus /usr/local/bin/promtool

Step 5: Configure Prometheus as a Service

  1. Create a systemd service file:

    sudo nano /etc/systemd/system/prometheus.service
  2. Add the following configuration:

    [Unit] Description=Prometheus Monitoring System 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/ [Install]  WantedBy=multi-user.target
  3. Reload systemd to apply the new service:

    sudo systemctl daemon-reload
  4. Start and enable the Prometheus service:

    sudo systemctl start prometheus sudo systemctl enable prometheus

Step 6: Verify Installation

  1. Check the status of the Prometheus service:

    sudo systemctl status prometheus
  2. Access the Prometheus web interface: Open your browser and go to:

    Replace <your-server-ip> with your server’s IP address.

  3. http://<your-server-ip>:9090


Step 7: Configure Prometheus Targets

  1. Open the Prometheus configuration file:

    sudo nano /etc/prometheus/prometheus.yml
  2. Add or modify the scrape_configs section to include your monitoring targets:

    scrape_configs: - job_name: 'example-job' static_configs: - targets: ['localhost:9090']
  3. Restart Prometheus to apply changes:

    sudo systemctl restart prometheus


Comments

Popular posts from this blog

FastAPI Instrumentalisation with prometheus and grafana Part1 [Counter]

welcome to this hands-on lab on API instrumentation using Prometheus and FastAPI! In the world of modern software development, real-time API monitoring is essential for understanding usage patterns, debugging issues, and ensuring optimal performance. In this lab, we’ll demonstrate how to enhance a FastAPI-based application with Prometheus metrics to monitor its behavior effectively. We’ve already set up the lab environment for you, complete with Grafana, Prometheus, and a PostgreSQL database. While FastAPI’s integration with databases is outside the scope of this lab, our focus will be entirely on instrumentation and monitoring. For those interested in exploring the database integration or testing , you can review the code in our repository: FastAPI Monitoring Repository . What You’ll Learn In this lab, we’ll walk you through: Setting up Prometheus metrics in a FastAPI application. Instrumenting API endpoints to track: Number of requests HTTP methods Request paths Using Grafana to vi...

ExternalDNS on Kubernetes - mirecloud homelab part 4

MireCloud Home Lab · DevOps ExternalDNS on Kubernetes Automatic Sync with BIND via RFC2136 How to fully automate DNS management in a bare-metal Kubernetes homelab using Cilium, BIND, and HashiCorp Vault. 📅 February 22, 2026 ⏱ ~10 min read 🔧 ExternalDNS v0.20.0 ☸ Kubernetes v1.34 Kubernetes v1.34 ExternalDNS v0.20.0 Cilium Gateway API BIND (RFC2136) TSIG / HMAC-SHA256 HashiCorp Vault External Secrets Operator ArgoCD (GitOps) cert-manager When you run a Kubernetes homelab with multiple exposed services — Grafana, Keycloak, ArgoCD, PgAdmin — you quickly find yourself maintaining DNS entries in BIND manually . It's repetitive, prone to errors, and breaks the GitOps flow. The solution is ExternalDNS . This controller monitors your Services, Ingresses, and HTTPRoutes in real-time, automatically pushing DNS updates to BIND as soon as a route is created. No mo...

Introducing my homeLab Part 1

MireCloud Series — Part 1 I Was kubectl apply -ing Everything. Here's How I Stopped. Building MireCloud — the right way, from the ground up. EC Emmanuel Catin Senior Platform Engineer · CKA Vault ESO cert-manager ArgoCD Cilium I have a confession. For months, my homelab was held together with notes, memory, and hope. Keycloak was running. Grafana was up. GitLab was accessible. But if you asked me why something worked, half the time the honest answer was: "because I ran some commands six weeks ago and I haven't touched it since." Passwords lived in a notes file. Certificates were generated once with OpenSSL and forgotten until they expired. Secrets were committed to Git — sometimes as plaintext, sometimes base64-encoded, which is the same thing with extra steps. Every rebuild started ...