CentOS

How to Install Grafana on CentOS 8

How to Install Grafana on CentOS 8

Grafana is an open-source and one of the most commonly used monitoring dashboards of 2019 that is 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.

We will elaborate in this article on how to Grafana monitoring dashboard 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 Linux distribution

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

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

Step 2: Update yum repository

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

$ sudo dnf makecache

Now, all packages of your system are updated.

Step 3:  Install Grafana using Yum

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

$ sudo dnf -y install grafana

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

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

$ rpm -qi grafana

Step 4: Check 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

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

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

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

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

Step 7: Grafana Configurations

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:

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

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 yum –y remove grafana

Conclusion

Today, this article has installed the Grafana monitoring dashboard through the command line on CentOS 8 system in this article. Moreover, we have discussed how to enable and change the configurations of grafana according to your ease. Grafana alone is not very useful. Therefore, you will have to install grafana along with other tools such as Prometheus or Influx DB. Send us your queries via comments.

Similar Posts