Winter Sale - up to 36% OFF

How to Install Grafana on Ubuntu 24.04: Step-by-Step Guide

How to Install Grafana on Ubuntu 24.04: Step-by-Step Guide
Published on Jan 22, 2025 Updated on Jan 22, 2025

Monitoring your applications and services is essential to ensure that systems run as expected. However, traditional monitoring methods can sometimes fall short and miss critical issues, leading to significant problems down the line. That’s where Grafana comes in.

Grafana is a powerful tool. It turns complex data into easy-to-understand visuals called dashboards. These dashboards give a real-time view of your systems. They help you spot and fix issues before they escalate.

In this guide, we will walk you through installing Grafana on Ubuntu 24.04. We'll begin by ensuring your system is up-to-date. Then, we'll guide you through setting up Grafana and accessing the web interface.

#What is Grafana?

Grafana is an interactive web application for visualizing data. It allows you to transform time-series data into clear and insightful graphs. Grafana's ability to connect with various data sources makes it particularly special in the sense that it is not limited to any specific database.

You can link Grafana to multiple data sources, including Prometheus, InfluxDB, Elasticsearch, MySQL, and PostgreSQL databases. You can also connect to popular cloud services like AWS CloudWatch and Google Stackdriver.

This flexibility enables you to gather and monitor data from multiple sources in one place, making your analysis much more convenient.

Grafana also offers advanced querying capabilities. Its powerful query editors support each data source, enabling you to retrieve and manipulate data efficiently. You can use functions, combine data from different sources, and perform calculations to create meaningful visualizations.

Grafana has a great plugin system. It lets you enhance its features with plugins for more data sources, panels, and apps.

Lastly, the Grafana community is very active and supportive. They offer a ton of documentation and tutorials to help you get started. Moreover, Grafana has an Enterprise edition for organizations needing advanced features. It includes extra tools and professional support.

#What is Grafana used for?

Grafana is a versatile tool that serves many purposes across different fields. Here are some of the key ways you can use Grafana:

  • Monitoring Infrastructure: Grafana can provide insight into your company's apps, servers, and networks. It helps troubleshoot issues quickly. Metrics like CPU usage, memory use, and network flow clearly show your infrastructure's health.

  • Application Analytics: Grafana shows an app's performance and user interactions. It lets you improvise to improve the user experience and your app. Grafana helps track your app's response times, error rates, and user engagement. It does this based on key performance indicators.

  • DevOps and Continuous Integration: Grafana bridges Developers and Operations. It visualizes CI/CD pipelines, build statuses, deployment frequencies, test results, and more. This transparency helps teams find and fix bugs quickly. It makes the development process smooth.

  • Security Monitoring: Make sure your systems are secure. Grafana is useful for monitoring security metrics. It does this through log visualizations and tracking suspicious activities. You can create dashboards to show login attempts, firewall activities, and system vulnerabilities. This will help you respond to threats on time.

Deploy and scale your projects with Cherry Servers' cost-effective dedicated or virtual servers. Enjoy seamless scaling, pay-as-you-go pricing, and 24/7 expert support—all within a hassle-free cloud environment.

#Prerequisites

Before you start installing Grafana, make sure you have the following:

#Installing Grafana on Ubuntu 24.04

Follow these steps to install Grafana on your Ubuntu system.

#Step 1: Update system packages

Before installing new software, updating your system's package list and upgrading existing packages is important. Open your terminal and run the following commands:

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

This keeps your system up to date, ensures compatibility, and reduces potential issues during the installation process.

#Step 2: Install the required dependencies

Grafana requires certain dependencies to function properly. Install them by running:

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

Here's what each package does:

  • apt-transport-https: It lets you use HTTPS repositories. This ensures secure communication.

  • software-properties-common: It provides scripts to add and remove software repositories.

  • wget: A command-line utility used to download files from the internet.

These dependencies are vital. They add external repositories and securely download packages needed for Grafana.

#Step 3: Import the Grafana GPG key

Importing the Grafana GPG key allows your system to verify the authenticity of the Grafana packages. Run 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

This process creates a directory for storing keyrings if it doesn't already exist. It then downloads the Grafana GPG key and converts it into a format the package manager can use to authenticate packages.

#Step 4: Add the Grafana APT repository

Now, add the Grafana repository to your system's list of package sources. This will allow you to install Grafana using the apt package manager and receive automatic updates.

For the stable release, execute:

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

#Step 5: Update package lists again

After adding a new repository, update your package lists to include the packages from the Grafana repository:

sudo apt-get update

This command fetches the latest package information from all configured sources, including the newly added Grafana repository.

#Step 6: Install Grafana

No, you are ready to install Grafana. You have an open-source version versus an Enterprise version:

To install the open-source edition (Grafana OSS), run the following:

sudo apt-get install grafana -y

To install Grafana Enterprise, along with all the Enterprise features and plugins, use:

sudo apt-get install grafana-enterprise

Note:

  • Grafana OSS: Free and open-source with the most core functionalities the average user will need.

  • Grafana Enterprise: This provides the full functionality of Grafana OSS, adding enterprise capability features. It is available for free use. However, you can buy licenses for other value-added premium features and plugins.

#Step 7: Start and enable the Grafana service

After installing Grafana, you must start the Grafana server and ensure it runs whenever your system boots up.

Start the Grafana server by running:

sudo systemctl start grafana-server

Enable Grafana to start at boot:

sudo systemctl enable grafana-server.service

Enable Grafana to start at boot

To verify that Grafana is running correctly, check its status:

sudo systemctl status grafana-server

Check Grafana status

You should see an output indicating that the service is active and running. Starting and enabling the Grafana service ensures it runs after reboots, so you won't have to start it manually.

#Step 8: Adjust Firewall Settings

If UFW is active on your server, you must allow incoming traffic on Grafana's default port, 3000.

First, check if UFW is active:

sudo ufw status

If the firewall is active, allow traffic on port 3000 by running:

sudo ufw allow 3000/tcp

Reload the firewall to apply the changes:

sudo ufw reload

Apply firewall rules

Adjusting the firewall settings ensures you can access the Grafana web interface from your browser.

#Step 9: Access the Grafana Web Interface

The next step is to access the Grafana web interface through your browser. Visit the below URL:

http://your_server_ip:3000

Use the IP address of your actual Ubuntu server in place of your_server_ip. However, if you're accessing Grafana locally on the same machine where it's installed, you can use:

http://localhost:3000

Access the Grafana web interface

The Grafana login page will appear. Use the default credentials below to log in:

  • Username: admin
  • Password: admin

After logging in, Grafana will ask you to change the default password.

Change the Grafana default password

Choosing a strong, unique password is important to keep your Grafana setup secure.

The Grafana welcome page

Also read: How to install MongoDB on Ubuntu 24.04

#Conclusion

Congratulations on setting up Grafana on your Ubuntu 24.04 system! You now have a real-time tool for visualizing data and tracking your systems.

First, add data sources like Prometheus, InfluxDB, or MySQL to your Grafana config. Next, explore the functionalities of Grafana to personalize your dashboards. You can monitor system efficiency, app stats, and data. All within a single platform.

Remember to ensure that your system and Grafana are always up to date for secure operation.

Moreover, Grafana is generally helpful for anyone working with data; it is intuitive and versatile. Be it server monitoring, app performance assessment, or strategy building, Grafana has your back.

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 Jun 7, 2021 Updated on Jun 29, 2022

AlmaLinux Review: a CentOS Clone Supported by CloudLinux

AlmaLinux is an open-source Linux distribution focused on long-term stability, that is a 1:1 binary compatible fork of Red Hat Enterprise Linux (RHEL)

Read More
Published on Sep 14, 2021 Updated on Jun 29, 2022

Debian 11 "bullseye" Review: What‘s New?

Debian 11 “bullseye” was released on 14th of August 2021. This release contains over 11294 new packages out of 59551 packages overall in its repositories.

Read More
Published on May 31, 2022 Updated on May 5, 2023

A Complete Guide to Linux Bash History

Learn how to work with Bash history to become more efficient with any modern *nix operating system.

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: 92b971500.883