Skip to main content

How To Install Grafana on Ubuntu

In this guide we will show how to install and run Grafana on Ubuntu

Updated over 2 weeks ago

Grafana is a popular open-source platform for monitoring, visualization, and observability. It allows you to build dashboards from metrics, logs, and other data sources such as Prometheus, InfluxDB, MySQL, and many more.

Grafana runs as a single service, does not require a separate runtime stack, and is well suited for VPS environments.

This tutorial was tested on Ubuntu 22.04 / 24.04.

0. Prerequisites

  • SSH access to your VPS

  • Root or sudo privileges

  • Internet access

1. Installing Grafana

1.1 Update your system

Update the system packages:

apt update && apt upgrade -y

1.2 Install required dependencies

Grafana requires a few common packages for repository management:

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

1.3 Add the Grafana APT repository

Import the Grafana GPG key. On Ubuntu 24.04 run this command (skip to the next command, if you on Ubuntu 22.04):

wget -q -O - https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/grafana.gpg

On Ubuntu 22.04 run this:

mkdir -p /usr/share/keyrings
wget -q -O - https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/grafana.gpg

Also, on Ubuntu 22.04 you should create repo file (skip on Ubuntu 24.04):

nano /etc/apt/sources.list.d/grafana.list

Then paste this content (skip on Ubuntu 24.04):

deb [signed-by=/usr/share/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main

Save changes and exit.

Add the Grafana repository:

add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" 

Update package lists again:

apt update

1.4 Install Grafana

Install Grafana using APT:

apt install grafana -y

2. Managing the Grafana service

2.1 Start Grafana

You can start Grafana service by running this command:

systemctl start grafana-server

2.2 Enable Grafana on boot

To enable Grafana to start automatically at every boot, run the following command:

systemctl enable grafana-server

2.3 Check service status

To check Grafana status, use this command:

systemctl status grafana-server

You should see the service marked as active (running).

3. Firewall considerations (optional)

If you are using a firewall other than the default iptables configuration, make sure port 3000 is allowed.

Example using UFW:

ufw allow 3000/tcp

If you plan to expose Grafana publicly, consider:

  • Using a reverse proxy (NGINX)

  • Enabling HTTPS

  • Restricting access by IP or authentication

4. Accessing Grafana

By default, Grafana listens on port 3000.

Open your browser and go to:

http://your_server_ip:3000

Default login credentials

  • Username: admin

  • Password: admin

Enter your default login credentials:

On first login, Grafana will ask you to set a new password. Enter new password, confirm and click "Submit":

After that, you’ll be taken to the Grafana dashboard:

5. Basic usage

After logging in, you can:

  • Add a data source (Connections ---> Add new connection)

  • Create dashboards

  • Import community dashboards using dashboard IDs

  • Monitor system metrics, applications, or services

Grafana stores its configuration and data locally by default and does not require an external database for basic usage.

Did this answer your question?