(Last Updated On: February 1, 2019)

In this post, I’ll walk you through the installation of Grafana 6 on Ubuntu 18.04. Grafana v6.0 is out in Beta and it can be installed on Ubuntu, Debian and Red Hat based Linux distributions.

Grafana is an open source tool which allows you to query, visualize, alert on and understand your metrics no matter where they are stored. It enables you to easily create, explore, and share dashboards with your team and foster a data-driven culture.

For CentOS 7, check: How to Install Grafana 6 on CentOS 7

Step 1: Update system

Ensure your Ubuntu 18.04 system is up to date.

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Step 2: Download and Install Grafana 6

Download the beta release of Grafana 6 using wget command.

sudo apt-get -y install wget
wget https://dl.grafana.com/oss/release/grafana_6.0.0-beta1_amd64.deb
sudo dpkg -i grafana_6.0.0-beta1_amd64.deb

If you get an error like below:

$ sudo dpkg -i grafana_6.0.0-beta1_amd64.deb 
Selecting previously unselected package grafana.
(Reading database … 105291 files and directories currently installed.)
Preparing to unpack grafana_6.0.0-beta1_amd64.deb …
Unpacking grafana (6.0.0-beta1) …
dpkg: dependency problems prevent configuration of grafana:
grafana depends on libfontconfig; however:
Package libfontconfig is not installed.
dpkg: error processing package grafana (--install):
dependency problems - leaving unconfigured
Processing triggers for systemd (237-3ubuntu10.11) …
Processing triggers for ureadahead (0.100.0-20) …
Errors were encountered while processing:
grafana

Install missing dependencies by running the following command:

sudo apt-get -f install

And rerun the installation

$ sudo dpkg -i grafana_6.0.0-beta1_amd64.deb 
(Reading database … 107288 files and directories currently installed.)
Preparing to unpack grafana_6.0.0-beta1_amd64.deb …
Unpacking grafana (6.0.0-beta1) over (6.0.0-beta1) …
Setting up grafana (6.0.0-beta1) …
Restarting grafana-server service… OK
Processing triggers for systemd (237-3ubuntu10.11) …
Processing triggers for ureadahead (0.100.0-20) …

The grafana-service should be automatically started after the installation.

$ systemctl status grafana-server
grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)
Active: active (running) since Thu 2019-01-31 10:57:11 PST; 8min ago
Docs: http://docs.grafana.org
Main PID: 1616 (grafana-server)
Tasks: 10 (limit: 1110)
CGroup: /system.slice/grafana-server.service
`-1616 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=deb cfg:default.
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing PluginManager" logger=server
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Starting plugin search" logger=plugins
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Plugin dir created" logger=plugins dir=/var/lib/grafana/plugin
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing CleanUpService" logger=server
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing NotificationService" logger=server
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing ProvisioningService" logger=server
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=eror msg="Can't read alert notification provisioning files from director
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing TracingService" logger=server
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing Stream Manager"
Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="HTTP Server Listen" logger=http.server address=0.0.0.0:3000 pr

Ensure the service is set to run on boot.

sudo systemctl enable grafana-server

Step 3: Access Grafana 6 UI

Once the service has been started, you can access its web dashboard by visiting the server IP on port 3000.

Default logins are:

Username: admin
Password: admin

But you’re required to change immediately after authenticating.

Grafana Package details:

  • Installs binary to /usr/sbin/grafana-server
  • Installs Init.d script to /etc/init.d/grafana-server
  • Creates default file (environment vars) to /etc/default/grafana-server
  • Installs configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration sets the log file at /var/log/grafana/grafana.log
  • The default configuration specifies a sqlite3 db at /var/lib/grafana/grafana.db
  • Installs HTML/JS/CSS and other Grafana files at /usr/share/grafana

The systemd service file and init.d script both use environment vars on the file located at /etc/default/grafana-server.

Next steps include looking at Adding data sources

Step 4: Monitoring with Grafana

See our sample guides on how you can monitor your infrastructure using Grafana.

Monitor Linux System with Grafana and Telegraf

Monitoring Ceph Cluster with Prometheus and Grafana

How to Monitor BIND DNS server with Prometheus and Grafana

Monitoring MySQL / MariaDB with Prometheus in five minutes

How to Monitor Apache Web Server with Prometheus and Grafana in 5 minutes

How to Monitor Linux Server Performance with Prometheus and Grafana in 5 minutes