- Create users
sudo useradd --no-create-home --shell /sbin/nologin prometheus
- Create config dirs
sudo mkdir /etc/prometheus sudo mkdir /var/lib/prometheus sudo chown prometheus:prometheus /etc/prometheus sudo chown prometheus:prometheus /var/lib/prometheus
- Download prometheus
(Use the latest if possible @ prometheus repository)wget https://github.com/prometheus/prometheus/releases/download/v2.44.0/prometheus-2.44.0.linux-amd64.tar.gz - untar the contents
tar xvf prometheus-2.44.0.linux-amd64.tar.gz - copy the executables and give perms
cd prometheus-2.44.0.linux-amd64 sudo cp -f prometheus /usr/local/bin/ sudo cp -f promtool /usr/local/bin/ sudo chown prometheus:prometheus /usr/local/bin/prometheus sudo chown prometheus:prometheus /usr/local/bin/promtool - copy required libraries
sudo cp -rf consoles /etc/prometheus/ sudo cp -rf console_libraries /etc/prometheus/ sudo cp prometheus.yml /etc/prometheus/ sudo chown -R prometheus:prometheus /etc/prometheus/consoles sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml - remove the file
cd .. rm -rf prometheus-2.44.0.linux-amd64 prometheus-2.44.0.linux-amd64.tar.gz - create systemd service file @
/etc/systemd/system/prometheus.serviceecho '[Unit] Description=Prometheus Wants=network-online.target After=network-online.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/ \ --web.console.templates=/etc/prometheus/consoles \ --web.console.libraries=/etc/prometheus/console_libraries [Install] WantedBy=multi-user.target' | sudo tee /etc/systemd/system/prometheus.service > /dev/null - Setup systemd service startup at boot and enable it
sudo systemctl daemon-reload sudo systemctl enable --now prometheus - check
http://localhost:9090
- Download the latest release from prometheus repository
- Do 4, 5.
- Run
sudo systemctl restart prometheus
Same applies to
node_exporteror other***_exporters.node_exporternode_exporter/usr/local/bincd ./node_exporter-1.6.0.linux-amd64 sudo cp -f ./node_exporter /usr/local/bin/ sudo chown node_exporter:node_exporter /usr/local/bin/node_exportercd .. rm -rf ./node_exporter-1.6.0.linux-amd64/etc/systemd/system/node_exporter.servicesudo systemctl daemon-reload sudo systemctl enable --now node_exportersnmp_exporternode_exporter/usr/local/bincd ./snmp_exporter-0.21.0.linux-amd64 sudo cp -f ./snmp_exporter /usr/local/bin/ sudo chown snmp_exporter:snmp_exporter /usr/local/bin/snmp_exportercd .. rm -rf ./snmp_exporter-0.21.0.linux-amd64/etc/systemd/system/snmp_exporter.servicesudo systemctl daemon-reload sudo systemctl enable --now snmp_exporter