Network Monitoring

Linux: How to install Grafana on Ubuntu

Grafana is multi-platform open-source analytics and interactive visualization web application that integrates with complex data from sources like Prometheus, InfluxDB, Graphite, and ElasticSearch. It provides charts, graphs, and alerts for the web when connected to supported data sources. It is expandable through a plug-in system. This implementation will be performed on Ubuntu 20.04. See this guide on how to install Grafana on Windows 10 and Windows Server.

Grafana enables users to create complex monitoring dashboards using interactive query builders and also lets you create alerts, notifications, and ad-hoc filters for your data while also making collaboration with your teammates easier through built-in sharing features. You can download Grafana for all OS here.

Below are the steps to install Grafana on Ubuntu.
Step 1 – Update the system: For the difference between these commands below, see differences between Linux system Update, Upgrade, and Dist-upgrade.

sudo apt-get update
sudo apt-get upgrade

Note: This step is optional. It is advisable to reboot your server when updated and upgraded because the new kernel will be active (used) only after reboot.

Step 2 – Add Grafana GPG Key: Download the Grafana GPG key with wget or curl. This will add the key to your APT installation’s list of trusted keys, which will allow you to download and verify the GPG-signed Grafana package.

Note: You need Administrative privilege to have this step done as shown below.
– You need to have wget installed previously in order to do thus.

wget -q -O - | sudo apt-key add -

To verify that the GPG key was added correctly to your key repository, run the command below. This is a lab server only 🙂

sudo apt-key list

Step 3 – Add Grafana repository to your APT sources: If you install from the APT repository, then Grafana is automatically updated every time you run an apt-get update.

Grafana is available in the official Ubuntu 20.04 packages repository, the version of Grafana there may not be the latest, so use Grafana’s official repository s shown below.

Grafana VersionPackageRepository
Grafana OSSgrafana stable main
Grafana OSS (Beta)grafana beta main
Grafana Enterprisegrafana-enterprise stable main
Grafana Enterprise (Beta)grafana-enterprise beta main

Now to install the Grafana repository to your APT sources, run the following command below

sudo add-apt-repository "deb stable main

Next, refresh the APT cache to update your package lists

sudo apt update

Since there are 119 packages that can be upgraded, I will have to run the "sudo apt-get upgrade command again as discussed in step 1 above.
- This step can be ignored if you do not have additional packages to install.

Step 4 – Install Grafana.: Use the following command below to have Grafana installed on Ubuntu

sudo apt-get -y install grafana

Step 5 – Start the Grafana Service: Now that Grafana is installed on the server, we can now start the Grafana service by using the command below. This will start the Grafana Server process as the Grafana user, which was created during the package installation.

sudo systemctl start grafana-server

Step 6 – Verify Grafana Service Status: Next, we will verify that Grafana is running by checking the service’s status as shown below.

sudo systemctl start grafana-server

Step 7 – Start the Grafana Service upon boot up: Ensure the service is set to run on boot by using the command below

sudo systemctl enable grafana-server

This confirms that systemd has created the necessary symbolic links to autostart Grafana. The installation of Grafana is now complete and ready for use. You can proceed from here by installing an SSL certificate or a proxy server for Grafana.

Step 8 – Launch the Grafana Web interface: Upon installation and starting of the Grafana service, you can access the dashboard by visiting the server IP on port 3000. Since I am on the server, I will be accessing it via the localhost:3000.

The default port is 3000. In a production environment, you may need to open port 3000 on your network (router) and on the server itself (Grafana Server).

Below are the default credentials for Grafana.

Username: admin
Password: admin

Note: Every Grafana installation uses the same administrative credentials by default, therefore it is best practice to change your login information as soon as possible. upon entering the default password, you will be prompted to change your password. Simply enter your new password as shown below and click on submit.

Now we are presented with the default Grafana Home screen as shown below.

Refer to the Configuration page for details on options for customising your environment, logging, and database etc.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Buy me a coffeeBuy me a coffee

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x