How to install Grafana on Rocky Linux 8

Share on Social Media

In this tutorial, you will learn, how to install Grafana on Rocky Linux 8 and other RPM based distros. #centlinux #linux #grafana

What is Grafana? :

Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources. A licensed Grafana Enterprise version with additional capabilities is also available as a self-hosted installation or an account on the Grafana Labs cloud service. It is expandable through a plug-in system. End users can create complex monitoring dashboards using interactive query builders. Grafana is divided into a front end and back end, written in TypeScript and Go, respectively.

As a visualization tool, Grafana is a popular component in monitoring stacks, often used in combination with time series databases such as InfluxDB, Prometheus and Graphite; monitoring platforms such as Sensu, Icinga, Checkmk, Zabbix, Netdata, and PRTG; SIEMs such as Elasticsearch and Splunk; and other data sources. The Grafana user interface was originally based on version 3 of Kibana.

Grafana is licensed under an AGPLv3 license. Contributors to Grafana need to sign a Contributor License Agreement (CLA) that gives Grafana Labs the right to relicense Grafana in the future. The CLA is based on The Apache Software Foundation Individual Contributor License Agreement. (Source: Wikipedia)

Environment Specification:

We are using a minimal Rocky Linux 8 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux 8.5 (Green Obsidian)
  • Hostname – grafana-01.centlinux.com
  • IP Address – 192.168.116.129 /24

Update Linux Operating System:

Connect with grafana-01.centlinux.com as root user by using a ssh client.

Execute following command to build cache for installed yum repositories.

# dnf makecache
Rocky Linux 8 - AppStream                       1.6 kB/s | 4.8 kB     00:02
Rocky Linux 8 - BaseOS                          1.7 kB/s | 4.3 kB     00:02
Rocky Linux 8 - Extras                          1.8 kB/s | 3.5 kB     00:01
Metadata cache created.

As a best practice, update software packages in your Linux operating system before installing Grafana server.

# dnf update -y
Last metadata expiration check: 0:01:52 ago on Sun 20 Feb 2022 08:28:10 PM PKT.
Dependencies resolved.
Nothing to do.
Complete!

Our Linux server is already up-to-date. The result may vary on your operating system.

Check the Linux Kernel and operating system version, being used in this installation guide.

# cat /etc/rocky-release
Rocky Linux release 8.5 (Green Obsidian)

# uname -r
4.18.0-348.12.2.el8_5.x86_64

Add Grafana Yum Repository in Linux:

Create a .repo file in /etc/yum.repos.d directory by using vim text editor.

# vi /etc/yum.repos.d/grafana.repo

And add following directives in that file.

[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

Build the cache for Grafana yum repository.

# dnf makecache
Rocky Linux 8 - AppStream                       1.6 kB/s | 4.8 kB     00:02
Rocky Linux 8 - BaseOS                          1.2 kB/s | 4.3 kB     00:03
Rocky Linux 8 - Extras                          1.6 kB/s | 3.5 kB     00:02
grafana                                         169  B/s | 454  B     00:02
grafana                                         1.3 kB/s | 1.7 kB     00:01
Importing GPG key 0x24098CB6:
 Userid     : "Grafana <info@grafana.com>"
 Fingerprint: 4E40 DDF6 D76E 284A 4A67 80E4 8C8C 34C5 2409 8CB6
 From       : https://packages.grafana.com/gpg.key
Is this ok [y/N]: y
grafana                                         682 kB/s | 8.1 MB     00:12
Metadata cache created.

Install Grafana on Rocky Linux:

Since, you have added the Grafana yum repository, you can now easily install this Open Source analytics tool by executing following dnf command.

# dnf install -y grafana

After successful installation of Grafana server, enable and start the network service as follows.

# systemctl enable --now grafana-server
Synchronizing state of grafana-server.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable grafana-server
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service.

Check the status of Grafana service.

# systemctl status grafana-server
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; ve>
   Active: active (running) since Sun 2022-02-20 20:41:22 PKT; 6s ago
     Docs: http://docs.grafana.org
 Main PID: 1999 (grafana-server)
    Tasks: 8 (limit: 5808)
   Memory: 110.5M
   CGroup: /system.slice/grafana-server.service
           └─1999 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini -->

Feb 20 20:41:22 grafana-01.centlinux.com grafana-server[1999]: logger=sqlstore >
Feb 20 20:41:22 grafana-01.centlinux.com grafana-server[1999]: logger=plugin.ma>
Feb 20 20:41:22 grafana-01.centlinux.com grafana-server[1999]: logger=plugin.fi>
Feb 20 20:41:22 grafana-01.centlinux.com systemd[1]: Started Grafana instance.
Feb 20 20:41:22 grafana-01.centlinux.com grafana-server[1999]: logger=http.serv>

Configure Linux Firewall:

To make your Grafana server accessible across the network, you have to allow it in your Linux firewall.

# firewall-cmd --permanent --add-service=grafana
success

# firewall-cmd --reload
success

Access Grafana Server:

Open URL http://grafana-01.centlinux.com:3000/login in a web browser.

Grafana Server Login Page

Login by using default Grafana username/password i.e. admin/admin

Grafana Set Password for Admin user

Set a new strong password for your Grafana admin user.

Grafana Dashboard

You have successfully login to Grafana web application.

Conclusion:

In this article, you have learned how to install Grafana on Rocky Linux 8.

Scroll to Top