Would you like to learn how to perform a Grafana install on Ubuntu Linux? In this tutorial, we are going to show you how to install Grafana on Ubuntu Linux and how to access your Grafana web administration interface for the first time.

What is Grafana?

Grafana is an open-source platform for data monitoring, analysis, and visualization that comes with a web server that allows it to be accessed from anywhere.

On the Web interface, users are able to create Grafana dashboards with panels to represent metrics over time.

Grafana Tutorial:

On this page, we offer quick access to a list of Grafana tutorials.

Tutorial - Grafana Install

On the Linux console, use the following commands to install the MySQL database service.

# apt-get update
# apt-get install mysql-server

Use the following command to access the MySQL command-line.

# mysql -u root -p

Use the following SQL command to create a database named grafana.

CREATE DATABASE grafana CHARACTER SET UTF8 COLLATE UTF8_BIN;

Use the following SQL command to create a database user named grafana.

CREATE USER 'grafana'@'%' IDENTIFIED BY 'kamisama123';

Give the SQL user named grafana permission over the database named grafana.

GRANT ALL PRIVILEGES ON grafana.* TO 'grafana'@'%';
quit;

On the Linux console, use the following commands to configure the Grafana APT repository.

# mkdir /downloads/grafana -p
# cd /downloads/grafana
# wget https://packages.grafana.com/gpg.key
# apt-key add gpg.key
# add-apt-repository 'deb [arch=amd64,i386] https://packages.grafana.com/oss/deb stable main'
# apt-get update

Use the following command to install Grafana.

# apt-get install grafana

Edit the Grafana configuration file grafana.ini.

# vi /etc/grafana/grafana.ini

Perform the following configuration under the [Database] and [Session] sections.

[database]

type = mysql
host = 127.0.0.1:3306
name = grafana
user = grafana
password = kamisama123

[session]

provider = mysql
provider_config = `grafana:kamisama123@tcp(127.0.0.1:3306)/grafana`

Keep in mind that you need to change the MySQL username and password to reflect your environment.

Use the following command to start the Grafana service.

# service grafana-server start

The Grafana service will start listening on TCP port 3000.

Use the following command to see Grafana logs and verify if everything is working.

# cat /var/log/grafana/grafana.log

t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing ServerLockService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing UsageStatsService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing UserAuthTokenService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing CleanUpService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing NotificationService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing ProvisioningService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing TracingService" logger=server
t=2019-03-24T01:50:56+0000 lvl=info msg="Initializing Stream Manager"
t=2019-03-24T01:50:56+0000 lvl=info msg="HTTP Server Listen" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
t=2019-03-24T01:50:57+0000 lvl=info msg="cleanup of expired auth tokens done" logger=auth count=0

Grafana Dashboard Login

Open your browser and enter the IP address of your server plus :3000.

In our example, the following URL was entered in the Browser:

• http://34.216.84.149:3000

The Grafana web interface should be presented.

grafana default password

On the prompt screen, enter the Grafana Default Password login information.

• Username: admin
• Password: admin

The system will ask you to change the Grafana default password.

Grafana Default password change

After a successful login using the new password, the Grafana dashboard will be displayed.

If you want to start Grafana during boot time, use the following command:

# systemctl enable grafana-server.service

Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service.

Use the following command to check the status of the Grafana service.

# systemctl status grafana-server.service

Here is an example of the Grafana service status output

● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-03-24 02:13:58 UTC; 2min 15s ago
Docs: http://docs.grafana.org
Main PID: 758 (grafana-server)
Tasks: 9 (limit: 1152)
CGroup: /system.slice/grafana-server.service
└─758 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.logs=/var/log/grafana cfg:default.paths.d

Congratulations! You have successfully created a Grafana installation on Ubuntu Linux.