Grafana is a widely used open-source system monitoring solution for Linux servers. It is e.g. used by PayPal, eBay, and Red Hat. Grafana is a good choice for all engineers who want to use a scalable and robust dashboard monitoring tool. This monitoring tool monitors various data sources. Using Grafana, you can bind time-series databases like Prometheus or Influx DB and relational databases like PostgreSQL or MySQL.

This tutorial will show how to install Grafana on CentOS 8.

Prerequisites

You are required to log in as a root user on your system for running all administrative commands.

Installation of Grafana on CentOS 8

Grafana installation complete into the number of steps that are mentioned below:

Step 1: Add Grafana Yum repository

To install Grafana using the yum package manager, add the Grafana repository to the local yum repository. For this purpose, open the terminal using the ‘Activities’ sections and click on the terminal icon from the left sidebar of the CentOS 8 desktop. Now, create a new file ‘grafana.repo’ in the Yum repository and execute the following commands with administrative privileges on the terminal application:

$ cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo

[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF

How to Install Grafana Monitoring System on CentOS 8 centos linux

Enter the sudo password and the following output shows on the terminal:

How to Install Grafana Monitoring System on CentOS 8 centos linux

Step 2: Update yum repository

Update the available system packages by using the below-given command:

$ sudo dnf makecache

How to Install Grafana Monitoring System on CentOS 8 centos linux

Now, all packages of your system are updated.

Step 3:  Install Grafana using dnf

Once the Grafana repository is added and configured on your system, install Grafana by executing the below-mentioned command:

$ sudo dnf -y install grafana

How to Install Grafana Monitoring System on CentOS 8 centos linux Advertisement

The above command imports the GPG key and installs all required Grafana packages on CentOS 8.

How to Install Grafana Monitoring System on CentOS 8 centos linux

Once the installation of Grafana is completed, you might use the below-mentioned command to verify the installation and see the details of Grafana package:

$ rpm -qi grafana

How to Install Grafana Monitoring System on CentOS 8 centos linux

Step 4: Enable the Grafana systemd service

The systemd manages the grafana service on your system. Therefore, enable it by running the ‘systemctl’ command as follows:

$ sudo systemctl enable --now grafana-server.service

How to Install Grafana Monitoring System on CentOS 8 centos linux

Step 5: Start Grafana systemd service

Now, Grafana systemd service is enabled. Start service and then check ‘running or Active’ status of Grafana service by running the below-mentioned commands:

$ systemctl start grafana-server.service
$ systemctl status grafana-server.service

How to Install Grafana Monitoring System on CentOS 8 centos linux

Step 6: Enable firewall rules

By default, the grafana service runs on port 3000. So, if firewalld service is running on your system then, run the following command to allow access to port 3000 for grafana service:

 $ sudo firewall-cmd --add-port=3000/tcp --permanent
$ sudo firewall-cmd –reload

How to Install Grafana Monitoring System on CentOS 8 centos linux

To make sure everything is working correctly, use the below-given command:

$ sudo firewall-cmd --list-all | grep ports

How to Install Grafana Monitoring System on CentOS 8 centos linux

Step 7: Grafana Configuration files

All grafana configurations related to port and path are stored in the ‘/etc/grafana/grafana.ini’ configuration file. You can modify ‘http_port = 3000’ according to your system requirements. The grafana log is by default written in the ‘/var/log/grafana’ directory. The grafana SQLite database can be found under ‘/var/lib/grafana/grafana.db’.

Step 8:  Launch Grafana on CentOS 8 through Web UI

Launch the Grafana web user interface on CentOS 8. Open the browser and type the following URL in the address bar:

http://localhost:3000

Or

http://server-ip:3000

The Grafana web UI shows in your browser as follows:

How to Install Grafana Monitoring System on CentOS 8 centos linux

Enter the username=admin and password= admin to access the Grafana dashboard. After that, the following Grafana dashboard display in the browser:

How to Install Grafana Monitoring System on CentOS 8 centos linux

Congratulations! Grafana installation is completed. Now, you can use the Grafana monitoring dashboard on CentOS 8 system.

Remove or Uninstall Grafana monitoring tool from CentOS 8

After using Grafana on your system, you can uninstall this monitoring tool dashboard from CentOS 8 by using the below-given command:

$ sudo dnf remove grafana

Conclusion

Grafana is an open-source system monitoring tool for Linux servers that is extensively used. This guide will walk you through installing Grafana on CentOS. It’s an excellent option for any engineer looking for a scalable and reliable dashboard monitoring solution.