Install Grafana on Rocky Linux 8

|
Last Updated:
|
|

In this guide, we are going to learn how to install Grafana on Rocky Linux 8. 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.

Want to dive deep into Grafana? Check this link below;

Learn Grafana 7.0: A beginner’s guide to getting well versed in analytics, interactive dashboards, and monitoring

Installing Grafana on Rocky Linux 8

There are different methods on how to install Grafana. These include;

In this guide, we are going to learn how to demonstrate how to install Grafana using all these three methods.

Runs system update

To begin with, update your system packages.

dnf update

Installing Grafana automatically from Grafana YUM Repository

Installing Grafana from YUM repository

To install Grafana from YUM repository, you need to create YUM repos as follows

Well, there are two kinds of repos; Enterprise and Open-source software (OSS) repos.

In this demo, we are installing the Open source version of Grafana.


cat > /etc/yum.repos.d/grafana.repo << 'EOL'
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
EOL

Once the repos are in place, run the command below to install Grafana.

dnf install grafana -y

Installing Grafana manually via RPM package manager

Instead of creating Grafana repos as shown above, you would simply download latest stable release Grafana RPM binary from Grafana downloads page and install it using YUM package manager.

Grafana 8.0.5 is the current stable release as of this writing.

Obtain the link of the latest stable release version install Grafana by running the command below;

dnf install https://dl.grafana.com/oss/release/grafana-8.0.5-1.x86_64.rpm

Similarly, you can download the RPM package and install it as follows;

First, Install required dependencies;

dnf install initscripts urw-fonts wget -y

Next, download and install Grafana.

wget https://dl.grafana.com/oss/release/grafana-8.0.5-1.x86_64.rpm

Then install Grafana as follows;

rpm -Uvh grafana-8.0.5-1.x86_64.rpm

Grafana Package details

Any of the methods:

  • Installs binary to /usr/sbin/grafana-server
  • Copies init.d script to /etc/init.d/grafana-server
  • Installs default file (environment vars) to /etc/sysconfig/grafana-server
  • Copies configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration uses a log file at /var/log/grafana/grafana.log
  • The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db

Installing Grafana via Grafana Standalone Binary

Grafana has a ready made standalone Linux binary tarball that can simply downloaded and installed on an appropriate Grafana directory.

Download the latest standalone binary tarball from Downloads page.

VER=8.0.5
wget https://dl.grafana.com/oss/release/grafana-$VER.linux-amd64.tar.gz

Once the download completes, you can extract the tarball to an appropriate directory.

For example, to extract Grafana files to /usr/local/grafana directory;

mkdir /usr/local/grafana
dnf install tar -y
tar xzf grafana-$VER.linux-amd64.tar.gz --strip-components=1 -C /usr/local/grafana

You should now have your Grafana and its configuration files on /usr/local/grafana.

ls -1 /usr/local/grafana
bin
conf
LICENSE
NOTICE.md
plugins-bundled
public
README.md
scripts
VERSION

Note that no initialization scripts are installed with this method.

Running Grafana

Depending on the installation method you choose, Grafana can be run in different ways.

Managing Grafana Service with Systemd

Reload the systemd manager configuration.

systemctl daemon-reload

To start, stop, restart, check status or enable Grafana server to run on system boot, run the commands below respectively.

systemctl start grafana-server
systemctl stop grafana-server
systemctl restart grafana-server
systemctl enable grafana-server
systemctl status grafana-server

Managing Grafana Service with SysV

To start, stop, check status or enable Grafana to run on system boot, run the commands below respectively;

service grafana-server start
service grafana-server stop
service grafana-server status
chkconfig --add grafana-server

Managing Grafana Service with Standalone Binary

If you installed using the standalone Linux binary, then you need to navigate to the directory on which you extracted its configuration files to and execute the Grafana server binary as shown below.

cd /usr/local/grafana
./bin/grafana-server web

You can stop by pressing Ctrl+c.

Accessing Grafana from Web

Open Grafana Port on Firewall

Grafana listens on TCP port 3000 by default. To allow external access, open the port on FirewallD.

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

You can then access Grafana via the url, http://grafana-server-IP:3000.

Use the credentials admin for both username and password.

grafana interface

Reset the password when prompted and proceed to Grafana interface.

Install Grafana on Rocky Linux 8

You have successfully installed Grafana on Rocky Linux 8. In our next guide, we will cover how to visualize various system metrics with Grafana. Stay connected.

Reference

Installing Grafana on RPM-based Linux (CentOS, Fedora, OpenSuse, Red Hat) systems

Other Tutorials

Configure Grafana Email Alerting

Monitor SSL/TLS Certificate Expiry with Prometheus and Grafana

Monitoring Gitlab Metrics with Prometheus and Grafana

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
gen_too
Co-founder of Kifarunix.com, Linux Tips and Tutorials. Linux/Unix admin and author at Kifarunix.com.

Leave a Comment