Install Grafana on Ubuntu

Install Grafana on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

Grafana is a data visualization tool that lets you monitor data with the help of charts, graphs, and dashboards.

Grafana has two versions:

  • Grafana OSS: Free and open-source version with limited features.
  • Grafana Enterprise: Comes with a paid subscription and gives you additional functionality over the free version.

And in this tutorial, I will show you how you install them both.

How to install Grafana in Ubuntu

Grafana is not available in the default repositories of Ubuntu and in this tutorial, I will walk you through how you can add a Grafana repository for the installation.

The main benefit of using this method is you don't have to worry about updating the Grafana as it will automatically be updated when you update Ubuntu repositories.

First, install prerequisite packages using the following:

sudo apt install apt-transport-https software-properties-common wget

Once done, download the GPG key for Grafana:

sudo wget -q -O /usr/share/keyrings/grafana.key

Next, add the Grafana repository to your system:

echo "deb [signed-by=/usr/share/keyrings/grafana.key] stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

To take effect from the changes you've made, update the repository index:

sudo apt update

It's time for the installation.

Install Grafana OSS:

If you want to use the free version of Grafana, then, it can be installed with the following command:

sudo apt install grafana

Install Grafana Enterprise:

If you want to use their top-tier service will all the bells and whistles, you can install their Enterprise version using the following:

sudo apt install grafana-enterprise
DigitalOcean – The developer cloud
Helping millions of developers easily build, test, manage, and scale applications of any size – faster than ever before.
Get started on DigitalOcean with a $100, 60-day credit for new users.

How to Uninstall Grafana from Ubuntu

If you no longer want to have Grafana installed on your system, then, here's a quick way to remove Grafana from Ubuntu.

To uninstall Grafana, first, stop the service:

sudo systemctl stop grafana-server

Now, if you installed the Grafana OSS (free version), then, you have to use the following command to remove it from your system:

sudo apt remove grafana

And if you installed the Enterprise version of Grafana, then, you use the given command:

sudo apt remove grafana-enterprise

Optionally, you can also remove the repository from Ubuntu:

sudo rm -i /etc/apt/sources.list.d/grafana.list

That's it!

Wrapping Up...

In a related post, you may want to learn about installing Kibana.

How to Install Kibana on Ubuntu
Learn how to install Kibana on Ubuntu in proper way so that you can keep getting updates from official sources.

This was a quick tutorial on how you can install Grafana on Ubuntu including the removal steps.

I hope you will find this guide helpful.  And if you still have any queries, leave a comment.