Skip to content

Instantly share code, notes, and snippets.

@ricardoalcantara
Created March 16, 2026 05:47
Show Gist options
  • Select an option

  • Save ricardoalcantara/0a54d91cbe801f49d6df432e1eda3cc5 to your computer and use it in GitHub Desktop.

Select an option

Save ricardoalcantara/0a54d91cbe801f49d6df432e1eda3cc5 to your computer and use it in GitHub Desktop.
Install Node Exporter as a systemd service
#!/bin/bash
# Install Node Exporter as a systemd service
VERSION="1.10.2"
ARCH="linux-amd64"
# Download, extract, and install
wget https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.${ARCH}.tar.gz
tar xzf node_exporter-${VERSION}.${ARCH}.tar.gz
mv node_exporter-${VERSION}.${ARCH}/node_exporter /usr/local/bin/
rm -rf node_exporter-${VERSION}.${ARCH}*
# Create dedicated user (security best practice)
useradd --no-create-home --shell /bin/false node_exporter
chown node_exporter:node_exporter /usr/local/bin/node_exporter
# Create systemd service
cat <<EOF > /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=node_exporter
ExecStart=/usr/local/bin/node_exporter
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Start and enable
systemctl daemon-reload
systemctl enable --now node_exporter
@ricardoalcantara
Copy link
Author

Node Exporter Installer

Installs Node Exporter as a systemd service on Debian/Ubuntu servers.

Usage

curl -s https://gist.githubusercontent.com/ricardoalcantara/0a54d91cbe801f49d6df432e1eda3cc5/raw/065589800bf6c5a9387a5007bb9f3dadf0495bca/install_node_exporter.sh | bash

What it does

  • Downloads and installs Node Exporter v1.10.2
  • Creates a dedicated node_exporter system user
  • Registers and starts it as a systemd service
  • Exposes metrics on port 9100

After install

Verify it's running:

systemctl status node_exporter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment