Prometheus is a powerful time-series monitoring system and Grafana is the leading visualisation dashboard. Together they form the most popular open-source monitoring stack. This guide installs both on Ubuntu 24.04 LTS.
Tested and valid on:
- Ubuntu 24.04 LTS
Prerequisites
- Ubuntu 24.04 LTS server
- A user with sudo privileges
- Minimum 2 GB RAM
Step 1 – Create System Users
Create dedicated users for Prometheus and node_exporter:
sudo useradd --no-create-home --shell /bin/false prometheus
sudo useradd --no-create-home --shell /bin/false node_exporter
Step 2 – Download and Install Prometheus
Download the latest Prometheus release:
cd /tmp
wget https://github.com/prometheus/prometheus/releases/latest/download/prometheus-2.51.2.linux-amd64.tar.gz
tar xzf prometheus-2.51.2.linux-amd64.tar.gz
sudo mv prometheus-2.51.2.linux-amd64/prometheus /usr/local/bin/
sudo mv prometheus-2.51.2.linux-amd64/promtool /usr/local/bin/
sudo mkdir /etc/prometheus /var/lib/prometheus
sudo mv prometheus-2.51.2.linux-amd64/{consoles,console_libraries,prometheus.yml} /etc/prometheus/
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
Step 3 – Create the Prometheus Systemd Service
Create the service file:
sudo nano /etc/systemd/system/prometheus.service
Add:
[Unit]
Description=Prometheus Monitoring
After=network.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/
Restart=always
[Install]
WantedBy=multi-user.target
Start and enable:
sudo systemctl enable prometheus
sudo systemctl start prometheus
Step 4 – Install Node Exporter
Download and install the Node Exporter:
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/latest/download/node_exporter-1.7.0.linux-amd64.tar.gz
tar xzf node_exporter-1.7.0.linux-amd64.tar.gz
sudo mv node_exporter-1.7.0.linux-amd64/node_exporter /usr/local/bin/
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
Create a service and start it:
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
Step 5 – Add Node Exporter to Prometheus Config
Edit /etc/prometheus/prometheus.yml:
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
Restart Prometheus:
sudo systemctl restart prometheus
Step 6 – Install Grafana
Add the Grafana APT repository and install:
sudo apt install -y apt-transport-https software-properties-common
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
sudo apt update && sudo apt install grafana -y
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
Step 7 – Configure Grafana with Prometheus
Visit http://your_server_ip:3000 (default credentials: admin/admin). Go to Configuration → Data Sources, select Prometheus, set URL to http://localhost:9090, and save. Import dashboard ID 1860 for the Node Exporter Full dashboard.
Conclusion
Prometheus and Grafana are now running on Ubuntu 24.04 LTS. You have a full metrics collection and visualisation stack. Add more exporters (MySQL, Nginx, Redis) to gain insight into all your services.