Install Latest Grafana on CentOS 8

|
Last Updated:
|
|

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

Installing Grafana on CentOS 8

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

  • Installing Grafana automatically via YUM package manager
  • Installing Grafana manually via RPM package manager
  • Installing Grafana via Grafana Standalone Binary

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

Runs system update

To begin with, update your system packages.

dnf update

Installing Grafana automatically via YUM Package Manager

To install Grafana automatically via YUM package manager, there are two ways;

  • Create the Grafana repos and install directly from these repos.
  • Download Grafana RPM binary and install it using YUM package manager.

Installing Grafana from YUM repository

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

Well, there are two kinds repos; Enterprise and Open-source software (OSS) repos. Our demo involves the use of the later.

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

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

dnf install grafana -y

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.

Obtain the download link of the latest stable release version and pull the RPM binary using wget. Grafana 6.7.1 is the current stable release as of this writing.

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

Once the download completes, install it as follows;

dnf install grafana-6.7.1-1.x86_64.rpm

You can as well install it directly without having to download it;

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

or

dnf localinstall https://dl.grafana.com/oss/release/grafana-6.7.1-1.x86_64.rpm

Installing Grafana manually via RPM package manager

To manually install Grafana via RPM package manager, you have to download the latest RPM binary installer from the Grafana downloads page.

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

Install required dependencies;

dnf install initscripts urw-fonts -y

Then install Grafana as follows;

rpm -Uvh grafana-6.7.1-1.x86_64.rpm

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.

wget https://dl.grafana.com/oss/release/grafana-6.7.1.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
tar xzf grafana-6.7.1.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 /usr/local/grafana
bin  conf  LICENSE  NOTICE.md  public  README.md  scripts  tools  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

To start and enable Grafana to run on boot at the same time;

systemctl enable --now 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.

Install Latest Grafana on CentOS 8

Reset the password when prompted and proceed to Grafana interface.

grafana interface

You have successfully installed Grafana on CentOS 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

Related Tutorials

Integrate Prometheus with Grafana for Monitoring

Install Grafana Plugins Behind a Proxy server

Install Grafana 6.2.x on Ubuntu 18.04/Debian 9

Install Grafana Monitoring Tool on Fedora 29

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
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment