Upgrade Grafana to letest version

Raghav D
3 min readFeb 27, 2020

--

Upgrading a package safe (between many minor and one major version). grafana upgrade will make grafana more secure and update with the latest plugins, dash boards and graphs will look like same

Below steps needs to be follow :

  1. perform the backup of grafana.db (/var/lib/grafana/), Plugins (/var/lib/grafana/)
  2. perform the backup of grafana configuration file (i.e grafana.ini)
  3. try with yum upgrade/update <package>
  4. if above will not work, then we need to fresh install on top of it or else we need to remove existing version, and install the latest version and check grafana.ini file, and start the service

Database backup:

performing backup of grafana DB backup always ensures that we can roll back easily to older versions also, During grafana service start up grafana will automatically migrate its schema ( if there are changes or new tables ).

  • Here we are using sqlite, so we need to take backup of /var/lib/grafana/grafana.db file
  • take the backup of plugins also, located at /var/lib/grafana/plugins

Backup of configuration file:

grafana.ini is the grafana service configuration file, it is located at /etc/grafana directory.

This will have all configurations of grafana service, generally it will have configuration details like service port number, Database

So as of now we have taken backups of grafana.db, grafana.ini and plugins,

below find the file permissions of those file :

/etc/grafana:

-rw-r — — -. 1 root grafana 17262 Oct 11 08:28 grafana.ini

/var/lib/grafana/

-rw-r — r — . 1 grafana grafana 8421376 Dec 20 03:12 grafana.db

drwxr-xr-x. 16 grafana grafana 4096 Sep 5 06:01 plugins

drwx — — — . 2 grafana grafana 6 Dec 10 03:02 png

Yum update/upgrade:

Now we will try with yum upgrade command.

Before this we will stop the grafana service, systemctl stop grafana-server

yum update grafana

yum upgrade grafana

if the above commands gives you, no package found, then follow below steps:

$systemctl stop grafana-server

  • remove the grafana package

$yum remove grafana

  • Install the downloaded grafana package

dpkg -i grafana_<version>_amd64.deb

grafana-server -v

  • start the grafana service

Referrences:

--

--