How to Install Node Exporter, Prometheus, and Grafana on Linux Debian

In this guide, we will walk you through the steps to install Node Exporter, Prometheus, and Grafana on a Linux Debian system. These tools are essential for monitoring and visualizing system metrics.


Prerequisites

Before starting, ensure you have the following:


Step 1: Install Node Exporter

Node Exporter is a tool that collects system metrics and makes them available for Prometheus to scrape.

  1. Download Node Exporter: Open your terminal and run the following command to download the latest version of Node Exporter:

    wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
    
  2. Extract the tarball: Extract the downloaded file using the following command:

    tar xvfz node_exporter-1.3.1.linux-amd64.tar.gz
    
  3. Move the binary to /usr/local/bin: Move the Node Exporter binary to a directory in your system's PATH:

    sudo mv node_exporter-1.3.1.linux-amd64/node_exporter /usr/local/bin/
    
  4. Create a systemd service file for Node Exporter: Create a systemd service file to manage Node Exporter as a service:

    sudo nano /etc/systemd/system/node_exporter.service
    

    Add the following content to the file:

    [Unit]
    Description=Node Exporter
    After=network.target
    
    [Service]
    User=node_exporter
    Group=node_exporter
    ExecStart=/usr/local/bin/node_exporter
    
    [Install]
    WantedBy=multi-user.target
    
  5. Reload systemd and start Node Exporter: Reload the systemd daemon and start the Node Exporter service:

    sudo systemctl daemon-reload
    sudo systemctl start node_exporter
    sudo systemctl enable node_exporter
    
  6. Verify that Node Exporter is running: Check if Node Exporter is running by accessing its metrics endpoint:

    curl http://localhost:9100/metrics
    

Step 2: Install Prometheus

Prometheus is a monitoring and alerting toolkit that collects and stores metrics.

  1. Download Prometheus: Download the latest version of Prometheus using the following command:

    wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
    
  2. Extract the tarball: Extract the downloaded file:

    tar xvfz prometheus-2.30.3.linux-amd64.tar.gz
    
  3. Move the binaries to /usr/local/bin: Move the Prometheus and Promtool binaries to a directory in your system's PATH:

    sudo mv prometheus-2.30.3.linux-amd64/prometheus /usr/local/bin/
    sudo mv prometheus-2.30.3.linux-amd64/promtool /usr/local/bin/
    
  4. Create a configuration directory and copy the config file: Create a directory for Prometheus configuration and copy the default configuration file:

    sudo mkdir /etc/prometheus
    sudo cp prometheus-2.30.3.linux-amd64/prometheus.yml /etc/prometheus/
    
  5. Create a systemd service file for Prometheus: Create a systemd service file to manage Prometheus as a service:

    sudo nano /etc/systemd/system/prometheus.service
    

    Add the following content to the file:

    [Unit]
    Description=Prometheus
    After=network.target
    
    [Service]
    User=prometheus
    Group=prometheus
    ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data
    ExecReload=/bin/kill -HUP $MAINPID
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    
  6. Reload systemd and start Prometheus: Reload the systemd daemon and start the Prometheus service:

    sudo systemctl daemon-reload
    sudo systemctl start prometheus
    sudo systemctl enable prometheus
    
  7. Verify that Prometheus is running: Check if Prometheus is running by accessing its web interface:

    curl http://localhost:9090
    

Step 3: Install Grafana

Grafana is a visualization tool that allows you to create dashboards for your metrics.

  1. Add the Grafana repository: Add the Grafana repository to your system:

    sudo apt-get install -y apt-transport-https
    sudo apt-get install -y software-properties-common wget
    wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
    echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
    
  2. Update the package list and install Grafana: Update your package list and install Grafana:

    sudo apt-get update
    sudo apt-get install grafana
    
  3. Start and enable Grafana: Start the Grafana service and enable it to start on boot:

    sudo systemctl start grafana-server
    sudo systemctl enable grafana-server
    
  4. Verify that Grafana is running: Check if Grafana is running by accessing its web interface:

    curl http://localhost:3000
    
  5. Access Grafana: Open your web browser and navigate to http://<your-server-ip>:3000. Use the following default credentials to log in:

    • Username: admin
    • Password: admin

Step 4: Configure Prometheus as a Data Source in Grafana

  1. Log in to Grafana.
  2. Navigate to Configuration > Data Sources.
  3. Click Add data source.
  4. Select Prometheus.
  5. Set the URL to http://localhost:9090.
  6. Click Save & Test.

Step 5: Import a Dashboard

  1. Navigate to Dashboards > Manage.
  2. Click Import.
  3. Enter the dashboard ID 1860 (Node Exporter Full) and click Load.
  4. Select the Prometheus data source and click Import.

Conclusion

You have successfully installed Node Exporter, Prometheus, and Grafana on your Debian system. You can now monitor your system metrics and create beautiful dashboards to visualize them.

Happy monitoring!

CONTACT


2025 | @mcnwr