How to Install Prometheus and Node Exporter on Ubuntu 24.04
This guide explains how to manually install and configure Prometheus 2.55.1 together with Node Exporter 1.10.2 on an Ubuntu 24.04 server. The procedure follows the configuration provided in the Prometheus Ansible playbook.
- Prometheus 2.55.1
- Prometheus configuration files
- Prometheus systemd service
- Node Exporter 1.10.2
- Node Exporter systemd service
- Prometheus data directory
- Ubuntu 24.04 LTS server
- Root or sudo access
- Internet access
- An SSH connection to the server
Step 1: Connect to Your Ubuntu Server
From your computer, open PowerShell, Windows Terminal, or another SSH client. Connect to the Ubuntu server:
ssh username@SERVER-IP
Replace username with your Ubuntu username and SERVER-IP with your server IP address.
For example:
ssh ubuntu@203.0.113.10
Step 2: Check the Ubuntu Version
Confirm that the server is running Ubuntu 24.04:
lsb_release -a
You should see Ubuntu 24.04 information.
Step 3: Update Ubuntu
Update the package list:
sudo apt update
Upgrade installed packages:
sudo apt upgrade -y
Step 4: Install Required Packages
The Ansible playbook requires wget and tar. Install them with:
sudo apt install -y wget tar
Verify that they are available:
wget --version
tar --version
Step 5: Create the Prometheus Group
The Prometheus service runs using a dedicated system account. Create the Prometheus group:
sudo groupadd --system prometheus
Step 6: Create the Prometheus User
Create a system user called prometheus:
sudo useradd --system --no-create-home --shell /usr/sbin/nologin --gid prometheus prometheus
Verify the user:
id prometheus
Step 7: Create Prometheus Directories
Create the Prometheus configuration directory:
sudo mkdir -p /etc/prometheus
Create the Prometheus data directory:
sudo mkdir -p /var/lib/prometheus
Step 8: Download Prometheus 2.55.1
Move to the temporary directory:
cd /tmp
Download Prometheus 2.55.1:
wget https://github.com/prometheus/prometheus/releases/download/v2.55.1/prometheus-2.55.1.linux-amd64.tar.gz
Verify the downloaded archive:
ls -lh /tmp/prometheus-2.55.1.linux-amd64.tar.gz
Step 9: Extract Prometheus
Extract the Prometheus archive:
sudo tar -xzf /tmp/prometheus-2.55.1.linux-amd64.tar.gz -C /tmp
Check the extracted directory:
ls -lah /tmp/prometheus-2.55.1.linux-amd64
Step 10: Install the Prometheus Binary
Copy the Prometheus binary to /usr/local/bin:
sudo cp /tmp/prometheus-2.55.1.linux-amd64/prometheus /usr/local/bin/prometheus
Set the correct ownership:
sudo chown prometheus:prometheus /usr/local/bin/prometheus
Set executable permissions:
sudo chmod 755 /usr/local/bin/prometheus
Step 11: Install Promtool
Copy promtool:
sudo cp /tmp/prometheus-2.55.1.linux-amd64/promtool /usr/local/bin/promtool
Set ownership:
sudo chown prometheus:prometheus /usr/local/bin/promtool
Set permissions:
sudo chmod 755 /usr/local/bin/promtool
Step 12: Copy Prometheus Console Files
Copy the Prometheus consoles:
sudo cp -r /tmp/prometheus-2.55.1.linux-amd64/consoles /etc/prometheus/
Copy the console libraries:
sudo cp -r /tmp/prometheus-2.55.1.linux-amd64/console_libraries /etc/prometheus/
Step 13: Create the Prometheus Configuration
Create the Prometheus configuration file:
sudo nano /etc/prometheus/prometheus.yml
Paste the following configuration:
global:
scrape_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets:
- "localhost:9090"
- job_name: "node_exporter"
static_configs:
- targets:
- "localhost:9100"
Save the file:
- Press Ctrl + O
- Press Enter
- Press Ctrl + X
Step 14: Set Prometheus Directory Ownership
Give the Prometheus user ownership of the configuration directory:
sudo chown -R prometheus:prometheus /etc/prometheus
Give the Prometheus user ownership of the data directory:
sudo chown -R prometheus:prometheus /var/lib/prometheus
Step 15: Validate the Prometheus Configuration
Before starting Prometheus, use promtool to check the configuration:
sudo -u prometheus promtool check config /etc/prometheus/prometheus.yml
A valid configuration should report that the configuration file is valid.
Step 16: Create the Prometheus systemd Service
Create the systemd service:
sudo nano /etc/systemd/system/prometheus.service
Paste:
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
Restart=on-failure
RestartSec=5s
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 \
--web.listen-address=0.0.0.0:9090 \
--web.enable-lifecycle \
--log.level=info
[Install]
WantedBy=multi-user.target
Save the file using:
- Ctrl + O
- Enter
- Ctrl + X
Step 17: Download Node Exporter 1.10.2
Node Exporter collects hardware and operating-system metrics that Prometheus can monitor.
Move to /tmp:
cd /tmp
Download Node Exporter 1.10.2:
wget https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-amd64.tar.gz
Verify the archive:
ls -lh /tmp/node_exporter-1.10.2.linux-amd64.tar.gz
Step 18: Extract Node Exporter
Extract the Node Exporter archive:
sudo tar -xzf /tmp/node_exporter-1.10.2.linux-amd64.tar.gz -C /tmp
Check the extracted directory:
ls -lah /tmp/node_exporter-1.10.2.linux-amd64
Step 19: Install the Node Exporter Binary
Copy the binary:
sudo cp /tmp/node_exporter-1.10.2.linux-amd64/node_exporter /usr/local/bin/node_exporter
Set executable permissions:
sudo chmod 755 /usr/local/bin/node_exporter
Step 20: Create the Node Exporter User
Create the system user:
sudo useradd --system --no-create-home --shell /bin/false node_exporter
Verify the user:
id node_exporter
Step 21: Create the Node Exporter systemd Service
Create the service file:
sudo nano /etc/systemd/system/node_exporter.service
Paste:
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=node_exporter
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
Save the file:
- Press Ctrl + O
- Press Enter
- Press Ctrl + X
Step 22: Reload systemd
Reload systemd so Ubuntu detects both new services:
sudo systemctl daemon-reload
Step 23: Enable Prometheus
Enable Prometheus to start automatically after a reboot:
sudo systemctl enable prometheus
Start Prometheus:
sudo systemctl start prometheus
Step 24: Enable Node Exporter
Enable Node Exporter:
sudo systemctl enable node_exporter
Start Node Exporter:
sudo systemctl start node_exporter
Step 25: Check Prometheus Status
Run:
sudo systemctl status prometheus --no-pager
Look for:
Active: active (running)
Step 26: Check Node Exporter Status
Run:
sudo systemctl status node_exporter --no-pager
You should see:
Active: active (running)
Step 27: Check Prometheus Port
Prometheus listens on port 9090. Check the port:
sudo ss -tulpn | grep 9090
Test Prometheus locally:
curl -I http://localhost:9090
A successful response should contain:
HTTP/1.1 200 OK
Step 28: Check Node Exporter Port
Node Exporter listens on port 9100. Check the port:
sudo ss -tulpn | grep 9100
Test the Node Exporter metrics endpoint:
curl http://localhost:9100/metrics
You should see many lines of metric information.
Step 29: Open Prometheus in a Browser
Find the server IP address:
hostname -I
From another computer, open:
http://YOUR_SERVER_IP:9090
For example:
http://203.0.113.10:9090
Replace the example IP address with the actual IP address of your Ubuntu server.
Step 30: Check Node Exporter from the Browser
Node Exporter exposes its metrics at:
http://YOUR_SERVER_IP:9100/metrics
For example:
http://203.0.113.10:9100/metrics
A page containing Prometheus metrics confirms that Node Exporter is responding.
Step 31: Configure the Firewall
If UFW is enabled and you want Prometheus and Node Exporter to be accessible from another computer, allow their ports:
sudo ufw allow 9090/tcp
sudo ufw allow 9100/tcp
Reload UFW:
sudo ufw reload
Check the firewall:
sudo ufw status
Step 32: Verify Prometheus Targets
After opening Prometheus in your browser, go to the targets page:
http://YOUR_SERVER_IP:9090/targets
The configuration supplied in the playbook contains two scrape targets:
- Prometheus:
localhost:9090 - Node Exporter:
localhost:9100
Both targets should eventually show a healthy status.
Step 33: Check Prometheus Logs
If Prometheus is not running, check its logs:
sudo journalctl -u prometheus -n 100 --no-pager
To follow the logs live:
sudo journalctl -u prometheus -f
Press Ctrl + C to stop viewing the logs.
Step 34: Check Node Exporter Logs
View Node Exporter logs:
sudo journalctl -u node_exporter -n 100 --no-pager
To follow the logs:
sudo journalctl -u node_exporter -f
Step 35: Troubleshooting Prometheus
Prometheus does not start
Check the service:
sudo systemctl status prometheus --no-pager -l
Check the logs:
sudo journalctl -u prometheus -n 100 --no-pager
Check the configuration:
sudo -u prometheus promtool check config /etc/prometheus/prometheus.yml
Node Exporter does not start
Check:
sudo systemctl status node_exporter --no-pager -l
Then check:
sudo journalctl -u node_exporter -n 100 --no-pager
Prometheus cannot scrape Node Exporter
Check Node Exporter:
curl http://localhost:9100/metrics
If metrics are returned, check the Prometheus configuration:
sudo cat /etc/prometheus/prometheus.yml
The Node Exporter target should be:
localhost:9100
Step 36: Useful Service Commands
Restart Prometheus:
sudo systemctl restart prometheus
Restart Node Exporter:
sudo systemctl restart node_exporter
Stop Prometheus:
sudo systemctl stop prometheus
Stop Node Exporter:
sudo systemctl stop node_exporter
Start Prometheus:
sudo systemctl start prometheus
Start Node Exporter:
sudo systemctl start node_exporter
Step 37: Final Verification
Run the following commands to verify the complete installation:
sudo systemctl status prometheus --no-pager
sudo systemctl status node_exporter --no-pager
sudo ss -tulpn | grep -E '9090|9100'
curl -I http://localhost:9090
curl http://localhost:9100/metrics
If both services are running and the ports respond, the installation is complete.
Installation Complete
Prometheus and Node Exporter have been installed and configured on Ubuntu 24.04.
- Prometheus 2.55.1 is installed.
- Node Exporter 1.10.2 is installed.
- Prometheus runs as the
prometheussystem user. - Node Exporter runs as the
node_exportersystem user. - Prometheus uses port 9090.
- Node Exporter uses port 9100.
- Prometheus stores its data in
/var/lib/prometheus. - Prometheus configuration is stored in
/etc/prometheus. - Both services are configured to start automatically with systemd.
Configuration Summary
| Component | Configuration |
|---|---|
| Operating System | Ubuntu 24.04 LTS |
| Prometheus | 2.55.1 |
| Prometheus Port | 9090 |
| Prometheus Configuration | /etc/prometheus/prometheus.yml |
| Prometheus Data | /var/lib/prometheus |
| Node Exporter | 1.10.2 |
| Node Exporter Port | 9100 |
| Prometheus User | prometheus |
| Node Exporter User | node_exporter |
Prometheus:http://YOUR_SERVER_IP:9090
Prometheus Targets:http://YOUR_SERVER_IP:9090/targets
Node Exporter Metrics:http://YOUR_SERVER_IP:9100/metrics
This knowledgebase article follows the Prometheus and Node Exporter configuration provided in the supplied Ansible playbook, including Prometheus 2.55.1, Node Exporter 1.10.2, systemd services, port 9090, port 9100, and the supplied Prometheus scrape configuration.

