How to install and sett up Grafana in linux

In this guide, we are going to learn how to install and set up Grafana in Linux.

Grafana is a multi-platform open source analytics and interactive visualization web application. It provides charts, graphs, and alerts for the web when connected to supported data sources.

# Installing grafana in Debian or Ubuntu

To install the latest OSS release in ubuntu, first you need to add grafana osss gpg key, use this command:

1
2
3
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

Add this repository for stable releases:

1
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

Add this repository if you want beta releases:

1
echo "deb https://packages.grafana.com/oss/deb beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

After you add the repository, update packaged and install grafana:

1
2
sudo apt-get update
sudo apt-get install grafana

# Install Grafana on RPM-based Linux (CentOS, Fedora, OpenSuse, Red Hat)

Add a new file to your YUM repo using the method of your choice. The command below uses nano.

1
sudo vim /etc/yum.repos.d/grafana.repo

For OSS releases, add this content to the repo file:

1
2
3
4
5
6
7
8
9
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

Install Grafana with one of the following commands:

1
sudo yum install grafana

# Start the server with systemd

This starts the grafana-server process as the grafana user, which was created during the package installation.

To start the service and verify that the service has started:

1
2
3
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server

To configure the Grafana server to start on boot:

1
sudo systemctl enable grafana-server.service
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy