Prometheus monitoring/How To Install Prometheus in Linux

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.




 * 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.




 * Now, set the user and group ownership on the new directories to the prometheus user.



Downloading Prometheus

 * First, download and unpack the current stable version of Prometheus into your home directory.




 * Now, unpack the downloaded archive.



Copy the two binaries to the /usr/local/bin directory.
 * 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.




 * Set the user and group ownership on the binaries to the prometheus user created in Step 1.




 * Copy the consoles and console_libraries directories to /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.




 * Lastly, remove the leftover files from your home directory as they are no longer needed.