Created
March 16, 2026 05:47
-
-
Save ricardoalcantara/0a54d91cbe801f49d6df432e1eda3cc5 to your computer and use it in GitHub Desktop.
Install Node Exporter as a systemd service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 | bashWhat it does
node_exportersystem user9100After install
Verify it's running: