Install and Setup Grafana on Ubuntu 20.04 | 22.04

Vijay
YavarTechWorks
Published in
3 min readMar 30, 2023

Steps to Install and set up the Grafana on Ubuntu 20.04 and 22.04

Grafana

What is Grafana?

Grafana is an open-source platform for data visualization, monitoring, and analysis. It allows you to create and display interactive, customizable dashboards with real-time monitoring and analytics capabilities. Grafana supports a wide range of data sources, including time-series databases and relational databases.

With Grafana, you can easily create visualizations and alerts based on your data, as well as collaborate with other team members through sharing and annotations. It also provides advanced features like plugins, annotations, and panels, which allow you to extend the platform’s capabilities and create custom visualizations and integrations.

Grafana is widely used in industries such as IT, finance, healthcare, and more, for monitoring and analyzing various metrics, logs, and sensor data. It is known for its user-friendly interface, ease of use, and powerful features, making it a popular choice for data visualization and monitoring.

Installation of Grafana

Update your Ubuntu system using the following command:

sudo apt-get update

Getting packages on Ubuntu distributions

Add the Grafana repository to your Ubuntu installation:

sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

Install Grafana as a service

Now that all the packages are available, it is time for you to install them.

Update your package list using the following command:

sudo apt-get update

Install the Grafana package using the following command:

sudo apt-get install grafana

Check Grafana version

You can use the Grafana version command to check the currently installed version.

grafana-server -v

Start the Grafana service using the following command:

sudo systemctl start grafana-server

Enable the Grafana service to start on boot:

To start it and make sure that the service is always available every time the machine is restarted, type the command:

sudo systemctl enable grafana-server

Verify your Grafana installation

Check the status of the Grafana service to make sure it is running.
To verify it, run the following command:

sudo systemctl status grafana-server

Grafana should run automatically, but if this is not the case, make sure to start it.

sudo service grafana-server start

In the future to stop and restart the Grafana, the commands are:

Restart

sudo service grafana-server restart

Stop

sudo service grafana-server stop

Allow Grafana TCP port 3000 in the Firewall

Grafana's default HTTP port is 3000, you’ll need to allow access to this port on the firewall.

If your firewall is UFW type the following commands:

sudo ufw allow 3000/tcp

That’s it! You have now installed Grafana on Ubuntu. You can now start using it to create dashboards and visualize your data.

Set up Grafana

  1. Access the Grafana web UI by visiting http://localhost:3000 in your web browser.
grafana home screen
Grafana Home

2. Log in to Grafana with the default credentials (username: admin, password: admin).

grafana change password screen
Grafana Change Password

3. You should see the Grafana password change screen. Change your default password and click on the Submit button. You should see the Grafana dashboard on the following screen:

grafana dashboard screen
Grafana Dashboard

Conclusion
In this post, You have now installed and set up Grafana on Ubuntu. You can start exploring its features and creating your own dashboards to visualize your data.

--

--