How To Install Grafana Monitoring Tool on Ubuntu 18.04 LTS

Introduction

Grafana is an open source, enterprise-level monitoring system that is supported by Graphite, Prometheus, InfluxDB, Elasticsearch, and other databases. With this tool, it’s easy to create your dashboard to manage apps or for the purpose of monitoring infrastructure performance.

In this article, we will take you through the Installation process of Grafana on Ubuntu 18.04 LTS.

Prerequisites

Before you begin, you will need the following:

  • A virtual machine running on Ubuntu 18.04 server
  • A non-root user with sudo privileges

If everything is set, then let’s start the installation process.

Step 1- Installing Grafana

Grafana is not available in Ubuntu’s default repository. Therefore, to get started, you must add grafana repository to Ubuntu 18.04 system.

$ sudo nano /etc/apt/sources.list

This will a file with detailed content. Now copy the line below and paste it after the last line of the file’s content.

deb https://packagecloud.io/grafana/stable/debian/ stretch main

Now, save and exit the file.

Next, execute the command below to download the  GNU Privacy Guard (GPG) key.

$ sudo curl https://packagecloud.io/gpg.key

The key, will be downloaded automatically, but you need to execute the command below to install it.

$ sudo apt-key add -

The next step is to perform an update on Grafana repository, then install the application using the command below:

$ sudo apt-get update -y
$ sudo apt-get install grafana -y

After the installation process is complete, you will get an output similar to the one below:

Preparing to unpack .../grafana_5.1.3_amd64.deb ...
Unpacking grafana (5.1.3) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10) ...
Setting up grafana (5.1.3) ...
Adding system user `grafana' (UID 112) ...
Adding new user `grafana' (UID 112) with group `grafana' ...
Not creating home directory `/usr/share/grafana'.
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
 sudo /bin/systemctl daemon-reload
 sudo /bin/systemctl enable grafana-server
### You can start grafana-server by executing
 sudo /bin/systemctl start grafana-server
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10) ...

Now, execute the commands below to start Grafana and enable it so that it starts on boot time:

$ sudo systemctl daemon-reload
$ sudo systemctl enable grafana-server
$ sudo systemctl start grafana-server

Go ahead and check Grafana status:

$ sudo systemctl status grafana-server

The output should look like this:

? grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-06-13 15:43:13 UTC; 11s ago
     Docs: http://docs.grafana.org
 Main PID: 19946 (grafana-server)
    Tasks: 8 (limit: 1114)
   CGroup: /system.slice/grafana-server.service
           ??19946 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid cfg:default.paths.l

Jun 13 15:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Executing migration" logger=migrator id="createuser
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Executing migration" logger=migrator id="create inde
Jun 13 15:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Executing migration" logger=migrator id="alter user_
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Created default admin user: admin"
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Starting plugin search" logger=plugins
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Plugin dir created" logger=plugins dir=/var/lib/graf
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Initializing Alerting" logger=alerting.engine
Jun 1315:43:19 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:19+0000 lvl=info msg="Initializing CleanUpService" logger=cleanup
Jun 1315:43:20 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:20+0000 lvl=info msg="Initializing Stream Manager"
Jun 1315:43:20 ubuntu1804 grafana-server[19946]: t=2018-06-13T15:43:20+0000 lvl=info msg="Initializing HTTP Server" logger=http.server address
lines1-19/19 (END)

Once you get this, now try to access Grafana.

Step 2 - Accessing Grafana

Now that Grafana is fully installed and successfully configured, try to access its dashboard.

To do so, go to your browser and enter the address http://your-server-ip:3000. You should be directed to a new page that looks like the one below:

How To Install Grafana Monitoring Tool on Ubuntu 18.04 LTS

Enter your admin credentials (username and password) for Grafana, in this case, use “admin” on both cases, then press the Log In. The Grafana dashboard should appear as shown below:

How To Install Grafana Monitoring Tool on Ubuntu 18.04 LTS

Now, everything is set and you have successfully installed Grafana monitoring tool on Ubuntu 18.04 LTS.

Conclusion

Congratulations! Grafana is now up and running and set to update you on what is happening with the systems and servers in your data center.

This monitoring system eliminates the guesswork on the actual activities taking place in your Linux machines as well as the services they offer. We hope it will be worth your time.

Check out these top 3 Linux hosting services

Was this article helpful?