Install Grafana on Rocky Linux 8

Grafana is an opensource monitoring & alerting tool that is widely used by companies for monitoring, data visualization, and analytics. It is written in Go and Typescript which provides highly customizable and feature-rich dashboards which can be configured to visualize data from a wide range of data sources. Grafana can be integrated with popular tools such as InfluxDB, Graphite and Prometheus to enhance monitoring and visualization of metrics.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related system monitoring queries.

In this context, we shall look into the installation process of Grafana on Rocky Linux.


Steps to install Grafana on Rocky Linux


1. Add Grafana repository on Rocky Linux

To get started, we will add the Grafana repository on our local system to take advantage of updates as they are rolled out. Therefore, create a repository file with the below command:

$ sudo vim /etc/yum.repos.d/grafana.repo

Next, paste the entire code provided below on the file and save the changes:

[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

Next, update your Rocky Linux repositories to sync with the newly added Grafana repository:

$ sudo dnf update

Along the way, you will be prompted to import the GPG key. Simply type 'y' and hit ENTER to proceed with importing the key.


2. Install Grafana 

Once the Grafana repository is added, the only thing remaining is to use the DNF package manager to install Grafana. Therefore, invoke the command:

$ sudo dnf install grafana

The command installs Grafana alongside a host of other dependencies.

You can probe the details of the version of Grafana installed using the command provided:

$ rpm -qi

This prints out details of Grafana such as the name, version, release number and installation date to mention just a few of the details.


How to Start and Enable Grafana ?

The Grafana service is, by default, inactive upon installation. We need to get it up and running using the command:

$ sudo systemctl start grafana-server

To enable Grafana server so that it comes on automatically on boot or upon a reboot, invoke the command:

$ sudo systemctl enable grafana-server

Just to be sure that Grafana is running, execute the command:

$ sudo systemctl status grafana-server


How to configure Firewall for Grafana ?

To access the Grafana GUI monitoring dashboard, we need to go an extra step and allow port 3000 on the firewall. This is the port that Grafana listens on by default. You can use the netstat command to verify this with the below command:

$ sudo netstat -pnltu

Therefore, run the following commands to allow the port across the firewall:

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

To verify that the port has been allowed on the firewall, run the command:

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


How to access Grafana dashboard ?

After all is said and done, the final task is to login to the Grafana dashboard. So launch your browser and browser the URL:

http://server-ip:3000

You will be redirected to the Grafana login page shown. The default credentials are:

Email / Username: Admin
Password: Admin

For security purposes, you will be required to reset the password and provide a stronger password to prevent possible breaches.

Finally, Grafana dashboard will be displayed.


[Need assistance in fixing Open Source Software Installation issues?  We can help you. ]

This article covers how you can add data sources from a myriad of environments and start monitoring your applications with Grafana on your Rocky Linux 8 system. In fact, Grafana is the open source analytics and monitoring solution that enables you to query, visualize and alert on various systems metrics that can be pulled from various time series databases such as Graphite, InfluxDB & Prometheus etc.

Related Posts