Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Devnix Blog

Tech Trends, Software Engineering & Cloud Insights

Devnix Blog

Tech Trends, Software Engineering & Cloud Insights

  • Home
  • Privacy Policy
  • Home
  • Privacy Policy
Close

Search

Subscribe
Cloud VPS Performance

Step‑by‑Step Guide to Install Prometheus and Node Exporter on a Linux VPS

By Devnix
May 29, 2026 1 Min Read
0


Step‑by‑Step Guide to Install Prometheus and Node Exporter on a Linux VPS

Prerequisites: A fresh Linux VPS (Ubuntu 22.04 LTS or Debian 12), a non‑root user with sudo privileges, basic familiarity with systemd, and an open TCP port 9090 for the Prometheus web UI. Ensure your firewall permits inbound traffic on this port.

1. Update the System and Install Required Packages

Start by refreshing the package index and installing tools needed for downloading binaries and managing services.

sudo apt update && sudo apt upgrade -y
sudo apt install -y wget curl gnupg lsb-release

2. Create a Dedicated Prometheus User

Running Prometheus as an unprivileged user isolates it from the rest of the system.

sudo useradd --no-create-home --shell /usr/sbin/nologin prometheus
sudo mkdir -p /etc/prometheus /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus /var/lib/prometheus

3. Download and Install Prometheus

Grab the latest stable release from the official GitHub page, extract it, and move the binaries to /usr/local/bin.

VERSION=$(curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest \
| grep tag_name | cut -d '"' -f 4)
wget https://github.com/prometheus/prometheus/releases/download/${VERSION}/prometheus-${VERSION#v}.linux-amd64.tar.gz
tar xzf prometheus-${VERSION#v}.linux-amd64.tar.gz
sudo cp prometheus-${VERSION#v}.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-${VERSION#v}.linux-amd64/promtool /usr/local/bin/
sudo cp -r prometheus-${VERSION#v}.linux-amd64/consoles /etc/prometheus/
sudo cp -r prometheus-${VERSION#v}.linux-amd64/console_libraries /etc/prometheus/
sudo chown -R prometheus:prometheus /usr/local/bin/prometheus /usr/local/bin/promtool /etc/prometheus

4. Configure the Prometheus YAML File

Create a minimal prometheus.yml that scrapes the local Node Exporter and the Prometheus server itself.

global:
  scrape_interval: 15s
  evaluation_interval: 15s

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

  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']

Save the file and set proper ownership:

sudo tee /etc/prometheus/prometheus.yml > /dev/null <<EOF
$(cat <<'YAML'
global:
  scrape_interval: 15s
  evaluation_interval: 15s

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

  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']
YAML
)
EOF
sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml

5. Create a Systemd Service for Prometheus

Systemd will keep Prometheus running and restart it on failure.

sudo tee /etc/systemd/system/prometheus.service > /dev/null <<'EOF'
[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
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now prometheus

6. Install Node Exporter on the Same VPS

Node Exporter collects hardware‑level metrics (CPU, memory, disk, network) and exposes them on port 9100.

VERSION=$(curl -s https://api.github.com/repos/prometheus/node_exporter/releases/latest \
| grep tag_name | cut -d '"' -f 4)
wget https://github.com/prometheus/node_exporter/releases/download/${VERSION}/node_exporter-${VERSION#v}.linux-amd64.tar.gz
tar xzf node_exporter-${VERSION#v}.linux-amd64.tar.gz
sudo cp node_exporter-${VERSION#v}.linux-amd64/node_exporter /usr/local/bin/
sudo useradd --no-create-home --shell /usr/sbin/nologin node_exporter
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter

7. Systemd Service for Node Exporter

sudo tee /etc/systemd/system/node_exporter.service > /dev/null <<'EOF'
[Unit]
Description=Prometheus Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter

[Install]
WantedBy=default.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter

8. Open the Required Ports in the Firewall

If you are using UFW, allow traffic to the Prometheus UI (9090) and Node Exporter (9100). Adjust the rules if you run a different firewall.

sudo ufw allow 9090/tcp
sudo ufw allow 9100/tcp
sudo ufw reload

9. Verify the Installation

Browse to http://<your_vps_ip>:9090. The Prometheus web UI should load, and the “Targets” page will show both prometheus and node_exporter as UP.

curl http://localhost:9090/api/v1/targets

If you see JSON output with both jobs listed and a health status of “up”, the stack is operational.

10. Deploy Prometheus on a Scalable Cloud VPS

For production workloads you’ll want a VPS that can grow with your metrics volume. You can rely on DevNix Cloud VPS to provide the compute and SSD storage needed for long‑term time‑series data while keeping latency low.

11. Optional: Basic Alerting with Alertmanager

While not required for a simple setup, adding Alertmanager lets you receive email or Slack notifications when a metric breaches a threshold. Install it the same way you installed Prometheus, then add an alerting block to prometheus.yml pointing to the Alertmanager endpoint.

alerting:
  alertmanagers:
    - static_configs:
        - targets: ['localhost:9093']

After configuring rules in /etc/prometheus/alert.rules.yml and restarting the service, you’ll have a minimal alert pipeline.

Conclusion

By following these steps you now have a fully functional Prometheus server paired with Node Exporter on a Linux VPS. The stack collects CPU, memory, disk, and network metrics, stores them efficiently, and exposes a powerful query language (PromQL) through a web UI. With the optional Alertmanager integration you can turn raw numbers into actionable alerts, and the scalable Cloud VPS ensures you won’t run out of storage as your monitoring data grows.

Tags:

Linux VPS monitoringNode ExporterPrometheus monitoring
Author

Devnix

Follow Me
Other Articles
Previous

How to Harden a Linux VPS: UFW, Fail2Ban, and SSH Key Authentication Made Simple

Next

Step‑by‑Step Guide to Configure Multi‑Company in Odoo 16

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • WordPress Image Optimization: Native Settings vs Plugins vs CDN vs Server‑Side Solutions
  • Understanding Database Connection Pooling in Cloud Deployments
  • Odoo User Access Rights Audit Checklist – Secure Your ERP Without Over‑Privileging
  • WordPress Caching Showdown: Built‑In, Plugins, Server‑Side, or CDN?
  • Cloud VPS vs Managed WordPress Hosting vs Static Site Hosting: Which Platform Delivers the Best Uptime and Security for Small‑Business Websites?

Archives

  • June 2026
  • May 2026

Categories

  • Backup Strategies
  • Cloud VPS Performance
  • Docker Compose Deployment
  • Odoo Email Configuration
  • Odoo Inventory
  • Odoo Invoicing
  • Odoo Multi-Company Configuration
  • Odoo Subscriptions
  • Odoo User Management
  • Server Security
  • WordPress Migration
  • WordPress Performance Optimization

About Devnix Blog

A forward-thinking tech publication covering software engineering, cloud infrastructure, and modern digital transformation. Built for developers and tech enthusiasts.

Our Services

  • Cloud VPS Hosting
  • Managed ERP Solutions
  • DevOps Automation
  • Server Security & Optimization

Partners

  • Odoo Stack
  • Odoo Backup
  • Devnix Solutions
Copyright 2026 — Devnix Blog. All rights reserved. Devnix Solutions