How To Install Grafana on CentOS 7 / RHEL 7

Posted on 118 views

In this blog post, we’ll cover the steps to Install Grafana on CentOS 7 / RHEL 7 Linux system. Grafana v9 was recently released in with plenty of new features and is available for installation. Grafana is an open source tool which allows you to query, visualize and do alerting on your metrics no matter the backend data store.

For Ubuntu server, check:

New grafana features

  • 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 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: Install Grafana on CentOS 7 / RHEL 7

Grafana 6 is now available for installation. Add Grafana RPM repository to your system.

sudo tee  /etc/yum.repos.d/grafana.repo<

Once the repository is added, install grafana rpm package.

 sudo yum -y install grafana

See more details about installed package.

$ rpm -qi grafana
Name        : grafana
Version     : 9.2.0
Release     : 1
Architecture: x86_64
Install Date: Fri 14 Oct 2022 12:55:59 PM UTC
Group       : default
Size        : 322221756
License     : AGPLv3
Signature   : RSA/SHA512, Tue 11 Oct 2022 11:17:47 AM UTC, Key ID 8c8c34c524098cb6
Source RPM  : grafana-9.2.0-1.src.rpm
Build Date  : Tue 11 Oct 2022 11:17:07 AM UTC
Build Host  : 26376c2390a2
Relocations : /
Packager    : [email protected]
Vendor      : Grafana
URL         : https://grafana.com
Summary     : Grafana
Description :
Grafana

Step 2: Start Grafana service on CentOS 7 / RHEL 7

After the installation of Grafana 8 on CentOS 7, the service can be started and enabled to start on system start using systemctl service management command:

sudo systemctl enable --now grafana-server

The service should be in running state.

$ systemctl status grafana-server
 grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-10-14 12:56:20 UTC; 27s ago
     Docs: http://docs.grafana.org
 Main PID: 1675 (grafana-server)
   CGroup: /system.slice/grafana-server.service
           └─1675 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.path...

Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=infra.usagestats.collector t=2022-10-14T12:56:20.764465118Z level=info msg="registering usage stat providers" usageStatsProvidersLen=2
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=server t=2022-10-14T12:56:20.764986133Z level=info msg="Writing PID file" path=/var/run/grafana/grafana-server.pid pid=1675
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=provisioning.alerting t=2022-10-14T12:56:20.766121182Z level=info msg="starting to provision alerting"
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=provisioning.alerting t=2022-10-14T12:56:20.766151535Z level=info msg="finished to provision alerting"
Oct 14 12:56:20 cent7.mylab.io systemd[1]: Started Grafana instance.
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=http.server t=2022-10-14T12:56:20.787318772Z level=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl= socket=
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=ngalert t=2022-10-14T12:56:20.787441573Z level=info msg="warming cache for startup"
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=grafanaStorageLogger t=2022-10-14T12:56:20.792241841Z level=info msg="storage starting"
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=ticker t=2022-10-14T12:56:20.823961889Z level=info msg=starting first_tick=2022-10-14T12:56:30Z
Oct 14 12:56:20 cent7.mylab.io grafana-server[1675]: logger=ngalert.multiorg.alertmanager t=2022-10-14T12:56:20.82404206Z level=info msg="starting MultiOrg Alertmanager"

Step 3: Configure Firewall for Grafana

If you have an active firewalld service, ensure port 3000 is allowed.

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

Confirm the port is allowed in the firewalld.

$ firewall-cmd --list-all | grep 3000
ports: 3000/tcp

Step 4: Access Grafana UI on CentOS 7 / RHEL 7

Once the service has been started, you can access its web dashboard by visiting http://[serverip|hostname]:3000.

install-grafana-fedora-29-fedora-28-1024x584

The default login details are:

Username: admin
Password: admin

You’re asked to reset admin password after successful login. Provide a new password and confirm.

install-grafana-6-ubuntu-18-02

Grafana Package details:

  • Installs binary to /usr/sbin/grafana-server
  • Installs Init.d script to /etc/init.d/grafana-server
  • Creates a default file (environment vars) to /etc/sysconfig/grafana-server
  • Installs configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration sets the log file at /var/log/grafana/grafana.log
  • The default configuration specifies a sqlite3 db at /var/lib/grafana/grafana.db
  • Installs HTML/JS/CSS and other Grafana files at /usr/share/grafana

Step 5: Adding Data Sources to Grafana

Grafana supports many different storage backends for your time series data. Each Data Source has a specific Query Editor that is customized for the features and capabilities that the particular Data Source exposes.

The following datasources are officially supported:

Step 6: Monitoring with Grafana

See our few guides on how you can monitor your infrastructure using Grafana and InfluxDB / Prometheus.

Monitor Linux System with Grafana and Telegraf

Monitoring Ceph Cluster with Prometheus and Grafana

How to Monitor BIND DNS server with Prometheus and Grafana

Monitoring MySQL / MariaDB with Prometheus in five minutes

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.