Installing Grafana on Ubuntu 20.04

Posted on Monday, January 18, 2021


 Finally getting around to installing grafana on a local home server so I can graph a thing or two J  https://grafana.com/ [1]



Download and setup

First see what version of ubuntu you are on

 

  > lsb_release -a

 

 


 

On this particular server I have set up a second drive located at /prometheus and that is where I am going to place grafana (and later Prometheus… but not going over that in this tutorial)

 

Go check out grafana downloads at

https://grafana.com/grafana/download [2]

 



If you scroll down a little you can select your OS (linux)

Then you can get some simple instructions on how to download the latest

So let me download it

 

  >  wget https://dl.grafana.com/oss/release/grafana_7.3.7_amd64.deb

 


Add libfontconfig1 user and then install

 

  > sudo apt-get install -y adduser libfontconfig1
  > sudo dpkg -i grafana_7.3.7_amd64.deb

 

 


 

Check current status of grafana server

 

  > sudo systemctl status grafana-server

 

 



Enable the service so it will auto start on reboot

 

  > sudo /bin/systemctl enable grafana-server

 

 


 

Start the service then check its status

 

  > sudo systemctl start grafana-server
  > sudo systemctl status grafana-server

 

 


Now pull up the web page as a test

Let me pull ports to make this simpler to open

 

  > ssh prometheus -L 3000:localhost:3000

 


Now open up

http://localhost:3000/

 



Attempt to login as admin:admin




Wahoo..

 

OK now let’s tweak it.

 


 

Change directories

 

This is using systemD you can easily see the which systemD file by running this command

 

  > sudo systemctl status grafana-server

 

 


 

Let me go look at that file

 

  > sudo vi /lib/systemd/system/grafana-server.service

 

 






Open up this file

 

  > sudo vi /etc/default/grafana-server

 


And make a few edits


Since I am going to move these to my second drive

Now stop the service

 

  > sudo systemctl stop grafana-server

 

 

Make some directories, set ownership/permissions and move files

 

  > sudo mkdir -p /prometheus/grafana/data
  > sudo mkdir -p /prometheus/grafana/plugins
  > sudo chown -R grafana:grafana /prometheus/grafana
  > sudo mv /etc/grafana/grafana.ini /prometheus/grafana/

 

 

 


Install plugin

I am going to install a few plugins

Diagram
https://grafana.com/grafana/plugins/jdbranham-diagram-panel?pg=plugins&plcmt=featured-undefined [3]

 

and
Piechart
https://grafana.com/grafana/plugins/grafana-piechart-panel?pg=plugins&plcmt=featured-undefined [4]

OK now install a plugin via the command line

 

  > sudo grafana-cli --pluginsDir /prometheus/grafana/plugins plugins install jdbranham-diagram-panel

 


 

  > sudo grafana-cli --pluginsDir /prometheus/grafana/plugins plugins install grafana-piechart-panel

 


 

  > sudo chown -R grafana:grafana /prometheus/grafana/plugins

 

 


Stop and start Grafana

 

  > sudo systemctl stop grafana-server
  > sudo systemctl start grafana-server

 

 


Try it out
http://localhost:3000/

 


 

Opens your plugins
Or direct link http://localhost:3000/plugins



There is the Diagram tool

 


And PIE chart

 

 

Reboot and check

 

No last check reboot the box and see if it all comes back up.

 

  > sudo reboot now

 


Log back in with port forwarding

 

  > ssh prometheus -L 3000:localhost:3000

 


Check status

 

  > sudo systemctl status grafana-server

 

 



Log back in
http://localhost:3000/


Change password

 


Update the password for the admin since admin:admin is not really a safe one J

 

 

 

References

 

[1]      Grafana  
            
https://grafana.com
           Accessed 1/2020
[2]      Grafana Download page

            https://grafana.com/grafana/download
           Accessed 1/2020
[3]       Diagram Grafana plugin

             https://grafana.com/grafana/plugins/jdbranham-diagram-panel?pg=plugins&plcmt=featured-undefined
           Accessed 1/2020
[4]      Piechart Grafana plugin

            https://grafana.com/grafana/plugins/grafana-piechart-panel?pg=plugins&plcmt=featured-undefined
          Accessed 1/2020

 

No comments:

Post a Comment