Prometheus installation on CentOS 7

wget https://github.com/prometheus/prometheus/releases/download/v1.7.1/prometheus-1.7.1.linux-amd64.tar.gz
  • Install Prometheus
cd /opt
tar -zxvf /root/prometheus-1.7.1.linux-amd64.tar.gz
ln -s prometheus-1.7.1.linux-amd64 prometheus
useradd prometheus
chown prometheus:prometheus /opt/prometheus-1.7.1.linux-amd64/ -R
  • Create Systemd script
  • # /etc/systemd/system/prometheus.service
    [Unit]
    Description=Prometheus Server
    Documentation=https://prometheus.io/docs/introduction/overview/
    After=network-online.target
    
    [Service]
    
    User=prometheus
    Restart=on-failure
    ExecStart=/opt/prometheus/prometheus \
      -config.file=/opt/prometheus/prometheus.yml \
      -storage.local.path=/opt/prometheus/data
    [Install]
    WantedBy=multi-user.target
  • Run prometheus
    ln -s /opt/prometheus/prometheus.yml /etc
    systemctl daemon-reload
    systemctl start prometheus
    systemctl enable prometheus
    
  • Disable firewall
  • systemctl stop firewalld
    systemctl disable firewalld
    
  • Access prometheus on http://prometheus_host:9090/ (Warning: please keep web browser and server time synchronized via ntp or you might be unable to see anything).