tar -zxf prometheus-2.54.1.linux-amd64.tar.gz -C /opt mv /opt/prometheus-2.54.1.linux-amd64 /opt/prometheus ln -s /opt/prometheus/prometheus /usr/local/bin/prometheus
cat > /usr/lib/systemd/system/prometheus.service <<EOF [Unit] Description=prometheus After=network.target
[Service] Type=simple User=root ExecStart=/usr/local/bin/prometheus --config.file="/opt/prometheus/prometheus.yml" --storage.tsdb.path="/opt/prometheus/data/" --web.enable-lifecycle --storage.tsdb.retention.time=15d Restart=on-failure
[Install] WantedBy=multi-user.target EOF
systemctl daemon-reload systemctl start prometheus systemctl enable prometheus systemctl status prometheus
|