How to install Grafana on Ubuntu 18.04 and Debian 8

Filed Under: Ubuntu

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.

# sudo apt update -y 

Update Ubuntu System

Next, upgrade the system

# 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

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

Add Grafana GPG Key

Next, add the Grafana APT repository as shown

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

sudo apt update

Update the System
Next, install Grafana server

# 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

# systemctl status grafana-server

Check Grafana Status

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

# systemctl start grafana-server
# 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

# netstat -pnltu

Netstat Pnltu

To allow the port on the firewall run:

# ufw allow 3000/tcp
# 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:

# 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

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages