Cyber Month Deal - up to 36% OFF

How to Install Grafana on Ubuntu 22.04 | 9 Steps

Published on Nov 24, 2023 Updated on Apr 3, 2024

Grafana is a valuable tool that allows users to perform in-depth data analysis to gain insights into the behavior and performance of their system or application. This article will walk you through how to install Grafana on Ubuntu 22.04.

By the end of this guide, you should be ready to take advantage of Grafana's capabilities to monitor and visualize your data effectively.

What is Grafana?

Grafana is a popular open-source analytics and interactive visualization web application designed for monitoring and visualizing data and creating interactive dashboards. It allows you to query data and build graphs, charts, and dashboards of the data (metrics & logs) from various supported data sources, making it easier to interpret and understand the data.

What is Grafana used for?

Grafana enables you to create interactive and visually appealing dashboards for data visualization, similar to Tableau or its competitors. It allows real-time monitoring of various data sources, for example, for monitoring Kubernetes clusters, and supports in-depth data analysis, providing insights into your system's performance. This can help you make more informed decisions. Grafana also allows you to set up alerts based on predefined conditions, notifying you of issues before they become problems.

Prerequisites

This is a practical demonstration will show you how to install Grafana on Ubuntu 22.04 with practical examples, and to follow along, make sure you have:

  • An Ubuntu server (for this demonstration, a server from Cherry Servers was used).
  • A non-root user with sudo access

How to Install Grafana on Ubuntu 22.04: Step-by-step process

This section provides step-by-step instructions on how to install Grafana on Ubuntu 22.04 using the official APT repository.

Step 1 - Update and upgrade

First, you want to make sure your system's packages are up to date. You can do that by running the following command in your terminal:

sudo apt update -y && sudo apt upgrade -y

Update system packages

Step 2 - Install the required packages

Next, run the following command to install the packages needed for the installation:

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

Install required packages

Step 3 - Add the Grafana GPG key

Next, download and store the Grafana GPG key with the following commands:

sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null

The first command creates a directory where the key will be stored. The second command will download, convert, and store the key in the specified location for secure APT package management.

Add Grafana GPG key

Step 4 - Add Grafana APT repository

The Grafana package is not included in the default Ubuntu repositories by default. To install Grafana, you'll need to add the Grafana official APT repository to your system's APT sources. This will enable your system to recognize and retrieve Grafana packages during the installation process.

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

After adding the repository to your system, update the package index to include information from the newly added repository using:

sudo apt update

Add Grafana APT repository

Step 5 - Install Grafana

Now install Grafana using:

sudo apt install grafana

Install Grafana

Step 6 - Start the Grafana service

Once the Grafana installation process has been completed, you can verify the version using:

sudo grafana-server -v

Next, start the Grafana service and enable it to start automatically at system reboot using the following commands:

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Start Grafana service

Step 7 - Verify that the Grafana service is running

Now verify that the Grafana service is active by running the command below:

sudo systemctl status grafana-server

If the Grafana service was started successfully, you should see a sign that it is active and running.

Check Grafana service status

Step 8 - Open the port in the firewall

Port 3000 is Grafana's default port for its web interface. To allow external access to Grafana, you must enable the firewall and open port 3000. To do this, execute the following commands in your terminal:

sudo ufw enable 
sudo ufw allow ssh
sudo ufw allow 3000/tcp

Enable firewall and open port

Step 9 - Access the Grafana web interface

To access the Grafana web interface, open a web browser and enter the IP address of your server (or hostname if applicable), followed by port 3000. The URL format should be http://your_server_IP:3000. Once loaded, you should see the Grafana login page. The default credentials are:

  • Username: admin
  • Password: admin

Access Grafana web interface

You'll be prompted to create a new password. Input a secure password, confirm it, and click the "Submit" button.

Create a new password

Once done, you'll have access to Grafana's dashboard.

Grafana dashboard

How to uninstall Grafana

If you need to uninstall Grafana for any reason, you can do so by running the following commands:

sudo systemctl stop grafana-server
sudo apt remove grafana

Uninstall Grafana

Conclusion

To sum up, this guide showed how to install Grafana on Ubuntu 22.04. Whether you are an IT professional or someone monitoring a server's performance, Grafana is an important addition to your toolkit that allows you to visualize, query, set alerts for, and understand your metrics and logs from supported data sources in a user-friendly manner. At this point, you should have Grafana installed and working on your Ubuntu server, and you can now go on to explore its features. Find more information on Grafana’s official documentation.

Cherry Servers offers reliable cloud infrastructure, ideal for deploying and scaling your Grafana monitoring setup. Our range of virtual and dedicated server solutions provides a flexible hosting platform with hourly billing and free technical support 24/7.

Learn more about us here!

Cloud VPS - Cheaper Each Month

Start with $9.99 and pay $0.5 less until your price reaches $6 / month.

Share this article

Related Articles

Published on Aug 21, 2019 Updated on Jun 15, 2023

Can DDoS attacks harm your server and how to prevent them?

DDoS attacks can cause real harm to your system. Learn some practical examples of how to lower the risk and how to prevent ddos attacks.

Read More
Published on Nov 28, 2019 Updated on Aug 8, 2023

Streaming Servers: Everything You Need To Know

What are Live Streaming servers. How do they work? Why do you need a stable and fast network? We will try to cover these topics on our article.

Read More
Published on Jul 8, 2022 Updated on Oct 4, 2023

How to Install and Configure Apache Reverse Proxy Server With SSL/TLS Encryption

This step-by-step guide will explain what a reverse proxy is and show you how to install Apache reverse proxy server with SSL/TLS encryption.

Read More
We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: 06ac5732e.831