How To Install Grafana on Amazon Linux 2

Posted on 123 views

Grafana is an open source platform for monitoring and observability. It allows you to visualize, query, alert on metrics stored in various storage backends. With Grafana you can create, explore, and share your visualization dashboards with your team, friends or open source community and foster a data driven culture. In this article we will show you how to install Grafana on Amazon Linux 2 server.

In our recent article on monitoring we covered the installation and configuration of Prometheus monitoring tool on Amazon Linux 2. This guide is a continuation of our monitoring series. Some notable features of Grafana Monitoring platform are:

  • Visualize: Fast and flexible client side graphs with a multitude of options. Panel plugins for many different way to visualize metrics and logs.
  • Dynamic Dashboards: Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.
  • Explore Metrics: Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side.
  • Explore Logs: Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.
  • Alerting: Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.
  • Mixed Data Sources: Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources.

Install Grafana 8 on Amazon Linux 2

The steps used to install Grafana on Amazon Linux 2 server are straightforward. You’ll add a YUM repository and pull the latest software packages from the repository using yum package manager. There are two editions of Grafana that can be installed on Amazon Linux 2 machine.

  1. Grafana Enterprise
  2. Grafana OSS

The repository URL for the Enterprise edition is https://packages.grafana.com/enterprise/rpm and for the open source edition it is https://packages.grafana.com/oss/rpm.

Add Grafana YUM repository to Amazon Linux 2

Add a new file to your YUM repo using the method of your choice. I’ll use below single line commands to create a repository file in /etc/yum.repos.d/grafana.repo.

Adding OSS repository:

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

Adding Enterprise repository:

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

You can cat the file contents to confirm it is created as desired.

$ cat /etc/yum.repos.d/grafana.repo

If you run the yum repolist command, it should return output similar to below.

$ sudo yum repolist
repo id                                                                                      repo name                                                                                         status
amzn2-core/2/x86_64                                                                          Amazon Linux 2 core repository                                                                      27317
amzn2extra-docker/2/x86_64                                                                   Amazon Extras repo for docker                                                                          56
grafana                                                                                      grafana                                                                                           184+290
mariadb-main                                                                                 MariaDB Server                                                                                       80+3
mariadb-maxscale                                                                             MariaDB MaxScale                                                                                        4
mariadb-tools                                                                                MariaDB Tools                                                                                        14+1
repolist: 27655

Agree to retrieve repository GPG key.

Retrieving key from https://packages.grafana.com/gpg.key
Importing GPG key 0x24098CB6:
 Userid     : "Grafana "
 Fingerprint: 4e40 ddf6 d76e 284a 4a67 80e4 8c8c 34c5 2409 8cb6
 From       : https://packages.grafana.com/gpg.key
Is this ok [y/N]: y

Install Grafana 8 on Amazon Linux 2

With the repository created and confirmed to be working, proceed to install Grafana on Amazon Linux 2:

sudo yum install -y grafana

Installed package details.

$ rpm -qi grafana
Name        : grafana
Version     : 8.4.3
Release     : 1
Architecture: x86_64
Install Date: Thu Mar  3 00:10:14 2022
Group       : default
Size        : 249516612
License     : AGPLv3
Signature   : RSA/SHA256, Wed Mar  2 13:25:41 2022, Key ID 8c8c34c524098cb6
Source RPM  : grafana-8.4.3-1.src.rpm
Build Date  : Wed Mar  2 13:25:08 2022
Build Host  : 19d4347a1b89
Relocations : /
Packager    : [email protected]
Vendor      : Grafana
URL         : https://grafana.com
Summary     : Grafana
Description :
Grafana

Start and enable grafana service.

sudo systemctl enable --now grafana-server

Use systemctl command to check status of the service.

$ 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 2022-03-03 00:10:46 UTC; 11s ago
     Docs: http://docs.grafana.org
 Main PID: 3501 (grafana-server)
   CGroup: /system.slice/grafana-server.service
           └─3501 /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...

Access Grafana Web console

If you have a running firewalld service make sure you allow port 3000/tcp.

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

Open a web browser to access Grafana web console – http://[grafana_server_hostname_or_IP_address:3000/]

install-grafana-amazon-linux-01-2048x1088

The default login credentials are:

Username: admin
Password: admin

Reset admin password after initial login.

install-grafana-amazon-linux-02-2048x1088

Your Grafana server is now ready for data visualization.

install-grafana-amazon-linux-03-2048x1088

Keep visiting our website to get latest articles on monitoring and other technologies.

coffee

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