Wednesday, January 8, 2025
Google search engine
HomeGuest BlogsHow To Install Grafana on CentOS 8 / RHEL 8

How To Install Grafana on CentOS 8 / RHEL 8

How can I install Grafana on RHEL 8 / CentOS 8?. This guide will walk you through the installation of Grafana on RHEL / CentOS 8. Grafana is a free and open source feature-rich graph editor & metrics dashboard for various data sources such as Elasticsearch, Graphite, OpenTSDB, Prometheus, and InfluxDB.

We have other installation guides for Grafana, choose one for your Linux distribution.

Install Grafana on RHEL 8 / CentOS 8

Grafana can be installed on RHEL / CentOS 8 from YUM repository or by manually downloading and installing .rpm package. The former is preferred method since it is easy to update and uninstall Grafana with the yum package manager.

Some new features in Grafana are:

  • Library panels: Allow users to build panels that can be used in multiple dashboards
  • Prometheus metrics browser: Allows you to quickly find metrics and select relevant labels to build basic queries.
  • Grafana v8.0 alerts: Centralizes alerting information for Grafana managed alerts and alerts from Prometheus-compatible data sources in one UI and API.
  • Real-time streaming: Data sources can now send real-time updates to dashboards over a websocket connection
  • Bar chart visualization: A new visualization that supports categorical data
  • Histogram visualization: This hidden feature of the old Graph panel is now a standalone visualization
  • State timeline visualization: The State timeline visualization shows discrete state changes over time
  • Time series visualization out of Beta and is now graduating to a stable state
  • Download logs: When you inspect a panel, you can now download log results as a text (.txt) file.

Step 1: Add Grafana 8 YUM repository

Run the commands below as user with sudo privileges or as root user to add repository content.

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

You can optionally update you cache index for available packages:

sudo dnf makecache

Step 2: Install Grafana 8 on CentOS 8 / RHEL 8

When repository for Grafana has been configured, Grafana can be easily installed by running the commands below:

sudo dnf -y install grafana

Package info:

$ rpm -qi grafana
Name        : grafana
Version     : 10.0.3
Release     : 1
Architecture: x86_64
Install Date: Thu 17 Aug 2023 08:25:44 PM UTC
Group       : default
Size        : 306233375
License     : AGPLv3
Signature   : RSA/SHA512, Tue 25 Jul 2023 06:02:03 PM UTC, Key ID 9e439b102cf3c0c6
Source RPM  : grafana-10.0.3-1.src.rpm
Build Date  : Tue 25 Jul 2023 06:01:26 PM UTC
Build Host  : d4f202c8a214
Relocations : /
....

Step 3: Start Grafana Service

Grafana service is managed by systemd. Start the service and enable it to start on boot.

$ sudo systemctl enable --now grafana-server.service 
 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.

The default port used is 3000. If you have another process using this port, you’ll need to set custom port in Grafana configuration file /etc/grafana/grafana.ini.

http_port = 3000

Your grafana-server service should show running state.

$ systemctl status grafana-server.service 
 grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-08-17 20:26:20 UTC; 5s ago
     Docs: http://docs.grafana.org
 Main PID: 65519 (grafana)
    Tasks: 12 (limit: 22612)
   Memory: 80.4M
   CGroup: /system.slice/grafana-server.service
           └─65519 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:>

Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=modules t=2023-08-17T20:26:20.905639717Z level=warn msg="No modules registered..."
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=grafanaStorageLogger t=2023-08-17T20:26:20.908199054Z level=info msg="storage starting"
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=http.server t=2023-08-17T20:26:20.908778324Z level=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl= socket=
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=ngalert.state.manager t=2023-08-17T20:26:20.908941131Z level=info msg="Warming state cache for startup"
Aug 17 20:26:20 rocky8.mylab.io systemd[1]: Started Grafana instance.
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=ngalert.state.manager t=2023-08-17T20:26:20.927692625Z level=info msg="State cache has been initialized" states=0 duration=18.747655ms
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=ticker t=2023-08-17T20:26:20.927838623Z level=info msg=starting first_tick=2023-08-17T20:26:30Z
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=ngalert.multiorg.alertmanager t=2023-08-17T20:26:20.927878554Z level=info msg="starting MultiOrg Alertmanager"
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=grafana.update.checker t=2023-08-17T20:26:20.952073053Z level=info msg="Update check succeeded" duration=30.481503ms
Aug 17 20:26:20 rocky8.mylab.io grafana[65519]: logger=plugins.update.checker t=2023-08-17T20:26:20.996603281Z level=info msg="Update check succeeded" duration=75.476057ms

By default, Grafana will write logs to /var/log/grafana directory and its SQLite database is located under /var/lib/grafana/grafana.db

Step 4: Open firewall port for Grafana

If you have a running firewalld service, allow port 3000for access to the dashboard from the network:

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

Step 5: Access Grafana Dashboard

Grafana web dashboard is accessible on http://[Server IP|Hostname]:3000

install grafana rhel 8 centos 8 01

The default logins are:

username: admin
Password: admin

Change admin password in the next window.

install grafana rhel 8 centos 8 02

Now that you have Grafana installed in your RHEL 8 server, you can check our monitoring guides:

RELATED ARTICLES

Most Popular

Recent Comments