How to Install Grafana on Ubuntu Linux

This brief tutorial shows students and new users how to install and configure the Grafana monitoring and analytics platform on Ubuntu 16.04 | 18.04 LTS servers.

For those who don’t know about Grafana, it is open-source software that provides monitoring and analytics across network systems and runs on all major operating systems, including Ubuntu.

Grafana is a complete enterprise-grade server and logs monitoring system that combines data from diverse systems and databases into a single platform.

This post will show you how to perform a basic configuration after installing this open-source project backed by a vibrant community. You’ll also be able to log on to the Grafana server once installed.

For more about Grafana, please visit its homepage.

When you’re ready, continue below with the steps:

Install Grafana Package

To install Grafana, you can go and download its .deb package file and install it locally on the Ubuntu server. However, if you want to quickly and easily upgrade to newer software versions, you will want to add its official APT repository to Ubuntu.

To add its APT repository to Ubuntu, run the commands below to import its repository GPG key.

curl https://packages.grafana.com/gpg.key | sudo apt-key add -

After importing the repository key above, run the commands below to add its repository.

For its stable version, run the commands below:

echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

For its beta version, run the commands below. However, the beta version is not recommended for production, so you’ll probably use it in a non-production environment.

echo "deb https://packages.grafana.com/oss/deb beta main" | sudo tee /etc/apt/sources.list.d/grafana_beta.list

After adding the repository file above, run the commands below to update the APT package list and install Grafana packages:

sudo apt update
sudo apt-get install apt-transport-https grafana

Once installed, the commands below can stop, start and enable Grafana to automatically startup when the server boots up.

sudo systemctl stop grafana-server.service
sudo systemctl start grafana-server.service
sudo systemctl enable grafana-server.service

Configure Grafana Service

Grafana default configuration files are located under the/etc/default/grafana-server/ directory. The main configuration file is /etc/grafana/grafana.ini, which has a basic setup configured. You’ll need to make some changes to suit your environment.

To validate if Grafana is installed, run the commands below:

systemctl status grafana-server.service

You should see Grafana system status details as shown below:

● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-03-06 11:00:12 CST; 21s ago
     Docs: http://docs.grafana.org
 Main PID: 6985 (grafana-server)
    Tasks: 10 (limit: 4663)
   CGroup: /system.slice/grafana-server.service
           └─6985 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/graf

Mar 06 11:00:12 ubuntu1804 grafana-server[6985]: t=2019-03-06T11:00:12-0600 lvl=info msg="Initializi
Mar 06 11:00:12 ubuntu1804 grafana-server[6985]: t=2019-03-06T11:00:12-0600 lvl=info msg="Initializi

Access Grafana Web Portal

Now that the Grafana server is installed and access is allowed from the local machine use the address below to access the Grafana portal.

http://localhost:3000

The initial username and password are admin and admin. You’ll be prompted immediately upon entering to change the password. Enter and confirm and new password and continue.

Grafana Ubuntu install

Enjoy!

Grafana ubuntu setup

That’s it!

Congratulations! You have learned how to install the Grafana monitoring and analytics platform on Ubuntu 16.04 | 18.04 LTS servers.

You may also like the post below: