How To Install Prometheus on CentOS 8

Install Prometheus on CentOS 8

In this tutorial we will show you how to install Prometheus on CentOS 8. For those of you who didn’t know, Prometheus is an excellent open source monitoring system which allows us to collect metrics from our applications and stores them in a database, especially a time-series based DB. The biggest advantage of Prometheus is the query language it provides for data processing.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Prometheus on a CentOS 8 server.

Install Prometheus on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

Step 2. Add system user and group for Prometheus.

Run the command below to create prometheus system user and group:

Step 3. Create data directory for Prometheus.

Create a directory that will be used to store Prometheus data:

Step 3. Installing Prometheus on CentOS 8.

We need to download the latest release of Prometheus archive and extract it to get binary files:

Next, copy the two Prometheus files, prometheusand promtool, under the extracted Prometheus archive directory to the /usr/local/bin directory:

Configure Prometheus:

Configurations should be added to the “/etc/prometheus/prometheus.yml”, Open the configuration file for modification and adjust it such that it looks like:

Step 4. Create systemd Service unit.

You need to create a systemd service file, /etc/systemd/system/prometheus.service, configured as follows:

Reload the systemd service:

Step 5. Configure firewall for Prometheus.

Allow Prometheus through firewall:

Step 6. Set Ownership on Configuration Files and Directories.

Run the command below to set the ownership of Prometheus configuration files and directories to prometheus:

Step 7. Accessing Prometheus.

Prometheus will be available on HTTP port 9090 by default. Open your favorite browser and navigate to http://your-domain.com:9090 or http://server-ip-address:9090 and complete the required the steps to finish the installation.

Install Prometheus on CentOS 8

Congratulation’s! You have successfully installed Prometheus. Thanks for using this tutorial for installing Prometheus on CentOS 8 system. For additional help or useful information, we recommend you to check the official Prometheus website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!