How To Install Prometheus in Linux from binaries
Creating Service Users
- Create these two users, and use the --no-create-home and --shell /bin/false options so that these users can't log into the server.
sudo useradd --no-create-home --shell /bin/false prometheus
sudo useradd --no-create-home --shell /bin/false node_exporter
- Before we download the Prometheus binaries, create the necessary directories for storing Prometheus' files and data. Following standard Linux conventions, we'll create a directory in /etc for Prometheus' configuration files and a directory in /var/lib for its data.
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
- Now, set the user and group ownership on the new directories to the prometheus user.
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
Downloading Prometheus
- First, download and unpack the current stable version of Prometheus into your home directory.
- Now, unpack the downloaded archive.
tar xvf prometheus-2.0.0.linux-amd64.tar.gz
- This will create a directory called prometheus-2.0.0.linux-amd64 containing two binary files (prometheus and promtool), consoles and console_libraries directories containing the web interface files, a license, a notice, and several example files.
Copy the two binaries to the /usr/local/bin directory.
sudo cp prometheus-2.0.0.linux-amd64/prometheus /usr/local/bin/
sudo cp prometheus-2.0.0.linux-amd64/promtool /usr/local/bin/
- Set the user and group ownership on the binaries to the prometheus user created in Step 1.
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
- Copy the consoles and console_libraries directories to /etc/prometheus.
sudo cp -r prometheus-2.0.0.linux-amd64/consoles /etc/prometheus
sudo cp -r prometheus-2.0.0.linux-amd64/console_libraries /etc/prometheus
- Set the user and group ownership on the directories to the prometheus user. Using the -R flag will ensure that ownership is set on the files inside the directory as well.
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
- Lastly, remove the leftover files from your home directory as they are no longer needed.
rm -rf prometheus-2.0.0.linux-amd64.tar.gz prometheus-2.0.0.linux-amd64
See also
- Monitoring: On call, Monitoring software, Monitoring services, Resource monitoring, Metric colletion tools, network monitoring, SLA Management Monitoring Tools, Alarm/Alert, Resource starvation, Alerts and notifications, Monitoring Kubernetes, VictoriaMetrics, Sensu, LogicMonitor, Distributed tracing, Datadog Monitors
- Prometheus: Prometheus installation,
9090
, storage, Prometheus exporters: Node exporter9100
, Blackbox exporter, Prometheus alertmanager (changelog), Prometheus versions, Prometheus Node exporter releases,promtool
,amtool, tsdb
,/etc/default/prometheus, /etc/prometheus/prometheus.yml, journalctl -u prometheus
,/etc/default/prometheus-node-exporter
, PromQL,alert:
, Prometheus Operator, Thanos, VictoriaMetrics, PushGateway, Prometheus API,values.yml
, Amazon Managed Service for Prometheus
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Source: wikiversity
Advertising: