Grafana is a free and open-source monitoring system that is used for monitoring and visualizing metrics from host machines. It provides intuitive and appealing dashboards, and analytics coupled with the ability to customize your own dashboards for monitoring your infrastructure. In this guide, we will show you how you can install Grafana on Ubuntu 18.04 and Debian 8. Let’s dive in.

Step 1: Update the system

The first step in installing Grafana is to update system repositories. Log in as a sudo user using SSH and execute the following commands.

Copy
# sudo apt update -y

Update Ubuntu System

Next, upgrade the system

Copy
# sudo apt upgrade -y

Upgrade Ubuntu

Step 2: Add Grafana APt repository

The next step will involve adding Grafana’s APT repository.

For Ubuntu 18.04

But first, add the GPG key which will allow you to install signed packages

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

Add Grafana GPG Key

Next, add the Grafana APT repository as shown

Copy
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"

Install Grafana APT Repository

Step 3: Install Grafana

Once the repository has been added, update the system repositories

Copy
sudo apt update

Update the System
Next, install Grafana server

Copy
# sudo apt install grafana -y

Install Grafana Server

By default, Grafana should be running by default once installed. Additionally, you can check it’s status by running

Copy
# systemctl status grafana-server

Check Grafana Status

If grafana is disabled, you can start it an enable it on boot by executing:

Copy
# systemctl start grafana-server
Copy
# systemctl enable grafana-server

Start And Enable Grafana

Step 4: Allowing port 3000 on the UFW firewall

By default, Grafana listens to port 3000 on the UFW firewall. This can be verified using the netstat command as shown

Copy
# netstat -pnltu

Netstat Pnltu

To allow the port on the firewall run:

Copy
# ufw allow 3000/tcp
Copy
# ufw reload

Allow Grafana Port 3000 On Ufw Firewall

To confirm that you have successfully allowed the port on the firewall, check the firewall status using the command:

Copy
# ufw status

Check Ufw Status

Step 5: Accessing Grafana Server

The final step is accessing Grafana via the web browser. To do this, first launch your favorite web browser and browse your server’s URL as shown

http://server-IP:3000/

This displays a login page as shown below

Grafana Login

The default credentials are :


username: admin
password: admin

Once you’ve entered the credentials, you will be prompted to change the credentials with a more secure password to safeguard your system. Once done, click on the ‘Save‘ button.

Change Password

Grafana’s dashboard will be displayed as shown.

Grafana Dashboard

Reference: Grafana official website