Author: MichaelLast Updated: Fri, Feb 18, 2022
Grafana is a great open-source data visualization and monitoring tool that can be installed on Rocky Linux 8. It has a wide variety of features that make it perfect for monitoring your server performance and activity.
With Grafana, you can quickly see which services are running on your server and how theyâre performing. You can also see detailed information about CPU usage, memory usage, and disk space usage so you can keep your server running smoothly.
This guide explains how to install Grafana on Rocky Linux 8.
The default Rocky Linux Repository does not contain Grafana. The first step is to add the Grafana RPM repository. Open a new repo file named grafana.repo using your preferred text editor.
$ sudo nano /etc/yum.repos.d/grafana.repo
Populate the grafana.repo file with the following lines. Save and close the 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.cr
Update the system packages so that all the changes take effect.
$ sudo dnf update
repolist command below to verify that the Grafana repo is listed.
$ sudo dnf repolist repo id repo name appstream Rocky Linux 8 - AppStream baseos Rocky Linux 8 - BaseOS extras Rocky Linux 8 - Extras grafana grafana
Install Grafana by running the command below.
$ sudo dnf install grafana -y
Start, stop, and restart the Grafana service on your server. Grafana provides a systemd unit file that makes it easy to manage the service from the command line.
$ sudo systemctl start grafana-server $ sudo systemctl stop grafana-server $ sudo systemctl restart grafana-server
At this point, your Grafana server is running. Check the status of the service to make sure that everything is working correctly.
$ sudo systemctl status grafana-server grafana-server.service - Grafana instance Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; ve> Active: active (running) since Wed 2022-02-02 14:02:40 UTC; 58s ago
Enable the Grafana service to start automatically during boot.
$ sudo systemctl enable --now grafana-server 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.
Open the port in your firewall so you can access Grafana from another device. The process depends upon which software is running on your Linux server. This demo uses the firewalld firewall.
By default, grafana listens on port 3000. Ensure that your grafana service listens on port 3000.
$ ss -alntup | grep grafana tcp LISTEN 0 128 *:3000 *:* users:(("grafan -server",pid=86078,fd=9))
Note: If you already have another app that uses the 3000 port, you will get an empty output from your Grafana server. You will need to change the http_port = 3000 value in the usr/share/grafana/conf/defaults.ini file to something else, such as 3001. Then restart the Grafana service.
$ sudo nano /usr/share/grafana/conf/defaults.ini $ sudo systemctl restart grafana-server
Open port 3000 and allow the Grafana service through your firewall.
$ sudo firewall-cmd --add-port=3000/tcp --permanent
Reload the firewall to apply all of the new changes.
$ sudo firewall-cmd --reload
Finally, verify that the 3000 port has been opened.
$ sudo firewall-cmd --list-all
public (active) target: default icmp-block-inversion: no interfaces: eth0 eth1 sources: services: cockpit dhcpv6-client ssh ports: 3000/tcp
Now that everything is configured, it's time to access Grafana web UI. Open the browser and type the IP address of your Grafana server followed by:3000 to access Grafana Web UI.
For example, if your Grafana server IP address is 192.168.1.100, then visits:
On the login screen, provide the default username and password to access the Grafana dashboard.
Username: admin Password: admin
Click Log in.
On the next screen, provide a secure password for the Grafana dashboard. Click Submit.
After successfully logging in, you will get the Grafana Dashboard. You can now add data sources and visualize data.
You have successfully installed Grafana on Rocky Linux 8 and configured your firewall to allow access. At this point, you can create as many dashboards as you need and use Grafana as your visualization platform.
Please refer to the official documentation for more information.