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.
Table of Contents
Installing Grafana on Rocky Linux 8
There are different methods on how to install Grafana. These include;
- Installing Grafana automatically from Grafana YUM Repos
- Installing Grafana manually via RPM package manager
- Installing Grafana via Grafana Standalone Binary
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 updateInstalling 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 -yInstalling 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.rpmSimilarly, you can download the RPM package and install it as follows;
First, Install required dependencies;
dnf install initscripts urw-fonts wget -yNext, download and install Grafana.
wget https://dl.grafana.com/oss/release/grafana-8.0.5-1.x86_64.rpmThen install Grafana as follows;
rpm -Uvh grafana-8.0.5-1.x86_64.rpmAny 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.5wget https://dl.grafana.com/oss/release/grafana-$VER.linux-amd64.tar.gzOnce 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/grafanadnf install tar -ytar xzf grafana-$VER.linux-amd64.tar.gz --strip-components=1 -C /usr/local/grafanaYou should now have your Grafana and its configuration files on /usr/local/grafana.
ls -1 /usr/local/grafanabin
conf
LICENSE
NOTICE.md
plugins-bundled
public
README.md
scripts
VERSIONNote 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-reloadTo start, stop, restart, check status or enable Grafana server to run on system boot, run the commands below respectively.
systemctl start grafana-serversystemctl stop grafana-serversystemctl restart grafana-serversystemctl enable grafana-serversystemctl status grafana-serverManaging 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 startservice grafana-server stopservice grafana-server statuschkconfig --add grafana-serverManaging 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 webYou 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 --permanentfirewall-cmd --reloadYou can then access Grafana via the url, http://grafana-server-IP:3000.
Use the credentials admin for both username and password.

Reset the password when prompted and proceed to Grafana interface.

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

