Cyberithub

How to Install Grafana Monitoring Tool on Ubuntu 20.04 LTS [Best Steps]

Advertisements

In this article, I will take you through the steps to install Grafana Monitoring tool on Ubuntu 20.04 LTS but before that let me ask you an important question. Do you know what is the most unique feature in Grafana ? If you are still thinking then let me help you a bit - Grafana does not require you to inject data to a backend store or vendor database. It can take data from multiple sources no matter where it lives and can show you on a unifying interactive Dashboard.

Grafana is a multi-platform open source analytics and interactive visualization web application that gives meaningful insights to all the data collected from the relevant sources. We will see the easy and best steps to install this application in below section. More on official documentation.

How to Install Grafana Monitoring Tool on Ubuntu 20.04 LTS [Best Steps]

How to Install Grafana Monitoring Tool on Ubuntu 20.04 LTS

Also Read: How to Install Virtualmin on Ubuntu 20.04 LTS [Easy Steps]

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility installed in your Server.

 

Step 2: Add Repository

Since Grafana package is only available through Grafana Repository and not through Ubuntu Repository so we need to add the Grafana repo first by using add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" command as shown below. This will enable us to download the Grafana package directly by using apt package manager.

Advertisements

NOTE:

Please note that here I am using root user to run all the below commands. You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to the User.
root@admin:~# add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Hit:3 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Hit:5 https://apt.releases.hashicorp.com focal InRelease
Hit:6 https://packages.microsoft.com/repos/edge stable InRelease
Hit:7 http://ppa.launchpad.net/micahflee/ppa/ubuntu focal InRelease
Get:8 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:9 https://packages.grafana.com/oss/deb stable InRelease [12.1 kB]
Get:10 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease [86.6 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [283 kB]

 

Step 3: Add GPG Key

In the next step, you need to download the GPG Key using wget command and then add it to the list of APT trusted Keys using apt-key command. This will allow you to download and install the GPG signed Grafana package. In the below command you can also add -q or --quiet flag to only show the status of the command and ignore the rest of the output.

root@admin:~# wget -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
--2021-10-25 07:44:45-- https://packages.grafana.com/gpg.key
Resolving packages.grafana.com (packages.grafana.com)... 2a04:4e42:1d::729, 151.101.122.217
Connecting to packages.grafana.com (packages.grafana.com)|2a04:4e42:1d::729|:443... failed: Connection timed out.
Connecting to packages.grafana.com (packages.grafana.com)|151.101.122.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1694 (1.7K) [application/x-iwork-keynote-sffkey]
Saving to: ‘STDOUT’

- 100%[============================================================================>] 1.65K --.-KB/s in 0s

2021-10-25 07:46:55 (15.0 MB/s) - written to stdout [1694/1694]

OK

 

Step 4: Update Your Server

Then update the package cache with packages information from the newly added repository by using apt update or apt-get update command as shown below.

root@admin:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 https://packages.microsoft.com/repos/edge stable InRelease
Hit:3 https://apt.releases.hashicorp.com focal InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 http://ppa.launchpad.net/ansible/ansible/ubuntu focal InRelease
Get:7 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:8 http://ppa.launchpad.net/micahflee/ppa/ubuntu focal InRelease
Get:9 https://packages.grafana.com/oss/deb stable InRelease [12.1 kB]
Get:10 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease [86.6 kB]
Get:11 https://packages.grafana.com/oss/deb stable/main amd64 Packages [25.6 kB]

 

Step 5: Install Grafana Server

Now you can install the Grafana Server by using apt install grafana or apt-get install grafana command as shown below.

root@admin:~# apt install grafana
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
grafana
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 66.5 MB of archives.
After this operation, 224 MB of additional disk space will be used.
Get:1 https://packages.grafana.com/oss/deb stable/main amd64 grafana amd64 8.2.2 [66.5 MB]
Fetched 66.5 MB in 6s (10.8 MB/s)
Selecting previously unselected package grafana.
(Reading database ... 223248 files and directories currently installed.)
Preparing to unpack .../grafana_8.2.2_amd64.deb ...
Unpacking grafana (8.2.2) ...
Setting up grafana (8.2.2) ...
......................................................

 

Step 6: Start Grafana Server

After doing all the changes you can reload system manager configuration by using systemctl daemon-reload command as shown below.

root@admin:~# systemctl daemon-reload

Then enable the service by using systemctl enable grafana-server command.

root@admin:~# systemctl enable grafana-server
Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /lib/systemd/system/grafana-server.service.

Finally, start the service by using systemctl start grafana-server command.

root@admin:~# systemctl start grafana-server

You can check the Grafana Service Status using systemctl status grafana-server command.

root@admin:~# systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-10-25 09:54:17 IST; 5s ago
Docs: http://docs.grafana.org
Main PID: 6672 (grafana-server)
Tasks: 9 (limit: 2312)
Memory: 85.7M
CGroup: /system.slice/grafana-server.service
└─6672 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.l>

Oct 25 09:54:19 admin.localhost.com grafana-server[6672]: t=2021-10-25T09:54:19+0530 lvl=info msg="Path Provisioning" logger=settings path=/etc/grafana/prov>
Oct 25 09:54:19 admin.localhost.com grafana-server[6672]: t=2021-10-25T09:54:19+0530 lvl=info msg="App mode production" logger=settings

 

Step 7: Open Grafana Dashboard

To open the Grafana Dashboard, you need to first open your favorite Browser and then use the default URL http://<your_domain_address>:3000 to open the Dashboard.

How to Install Grafana Monitoring Tool on Ubuntu 20.04 LTS [Best Steps] 2

 

Step 8: Login to Grafana Dashboard

If you have not set your password explicitly through /etc/grafana/grafana.ini file then the default user name and password will be admin. Then Click on Log In. Once you logged in you can now create New Dashboard to monitor your Applications and Services as you can see below.

How to Install Grafana Monitoring Tool on Ubuntu 20.04 LTS [Best Steps] 3

Leave a Comment