Grafana connects to sources such as Prometheus, MySQL, and Elasticsearch, then presents that data as dashboards you can actually read at a glance. It’s widely used for server and application monitoring because it’s free, open-source, and works with almost any data backend. Here’s how to get it installed on Ubuntu.
This guide covers everything from the initial system update to your first login on the Grafana dashboard. There are six steps in total, and you’ll have Grafana running on Ubuntu once you’re through them.
Step 1: Update Your System
Refresh your package list before installing anything new. An outdated list occasionally causes version mismatches during installation, so it’s worth ten seconds now.
sudo apt update && sudo apt upgrade -y
This command pulls the latest package information and brings any outdated packages on your server up to date.
Step 2: Install the Required Dependencies
A few tools handle repository access and package downloads for Grafana.
sudo apt install -y apt-transport-https software-properties-common wget curl
- apt-transport-https – lets APT fetch packages over a secure connection
- software-properties-common – manages third-party repositories
- wget and curl – used to download files from the terminal
Most Ubuntu systems already have these installed. If a package is already installed, the command won’t cause any issues — it just confirms and moves on.
Step 3: Add the Grafana Repository
Grafana isn’t included in Ubuntu’s default repositories, so you’ll need to add it yourself, along with the signing key that confirms the packages are genuine.
Create a keyring directory and download the key:
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
Register the repository with APT:
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
Then refresh the package index so the new source is recognized:
sudo apt update
Related Read: How to Run Grafana with Docker? (Step-by-Step Guide for Beginners)
Step 4: Install Grafana
With the repository registered, installing Grafana is a single command:
sudo apt install grafana -y
Grafana pulls in its dependencies and creates the config folders during installation. Take a quick look at the install location to see for yourself:
cd /etc/grafana && ls
Three items should be present: grafana.ini (the main configuration file), an LDAP config for directory-based authentication, and a provisioning folder for dashboards and data sources.
Step 5: Start and Enable the Service
Bring the service online:
sudo systemctl start grafana-server
Grafana listens on port 3000 by default. Verify that the service is actually running:
sudo systemctl status grafana-server
You’re looking for active (running) in the output. If the status shows anything else, the logs printed just below it usually point to the cause.
To have Grafana start automatically after a reboot, enable it:
sudo systemctl enable grafana-server
Step 6: Log Into Grafana
Point your browser to your server’s IP address or hostname on port 3000:
http://your-server-ip:3000
Log in with the default credentials:
- Username: admin
- Password: admin
Grafana makes you change the password the first time you log in. Choose a stronger one when it prompts you.
A Few Important Considerations
A working install isn’t the same as a secure or production-ready one. A few things are worth handling before Grafana goes into daily use.
The default admin/admin login should never stay active longer than it takes to log in and change it. If Grafana needs to be reachable from outside your local network, open port 3000 on the firewall deliberately rather than by accident, and put the instance behind HTTPS instead of serving it over plain HTTP.
On its own, Grafana only draws what it’s given — it needs at least one data source, such as Prometheus or MySQL, before the dashboards mean anything. Before editing grafana.ini or the provisioning folder, keep a backup on hand; configuration mistakes are easier to undo than to diagnose.
Like any other service exposed on a server, Grafana should be kept current. Regular updates close known vulnerabilities and bring in whatever improvements the newer releases add.
