推荐二进制安装prometheus
#!/bin/bash cd /usr/local/src wget -O prometheus-2.20.1.linux-amd64.tar.gzhttps://github.com/prometheus/prometheus/releases/download/v2.20.1/prometheus-2.20.1.linux-amd64.tar.gz || wget -O prometheus-2.20.1.linux-amd64.tar.gz http://download.zhufunin.com/prometheus/prometheus-2.20.1.linux-amd64.tar.gz tar zxf prometheus-2.20.1.linux-amd64.tar.gz test -d /usr/local/prometheus || mv prometheus-2.20.1.linux-amd64 /usr/local/prometheus mkdir -p /prometheus/data wget -O /usr/lib/systemd/system/prometheus.service http://download.zhufunin.com/prometheus/prometheus.service systemctl daemon-reload systemctl enable prometheus systemctl start prometheus
手动启动的方式
/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/prometheus/data/