Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Grafana 7.0

You're reading from   Learn Grafana 7.0 A beginner's guide to getting well versed in analytics, interactive dashboards, and monitoring

Arrow left icon
Product type Paperback
Published in Jun 2020
Publisher Packt
ISBN-13 9781838826581
Length 410 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Eric Salituro Eric Salituro
Author Profile Icon Eric Salituro
Eric Salituro
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Getting Started with Grafana
2. Introduction to Data Visualization with Grafana FREE CHAPTER 3. A Tour of the Grafana Interface 4. An Introduction to the Graph Panel 5. Real-World Grafana
6. Connecting Grafana to a Data Source 7. Visualizing Data in the Graph Panel 8. Visualization Panels in Grafana 9. Creating Your First Dashboard 10. Working with Advanced Dashboard Features 11. Grafana Alerting 12. Exploring Logs with Grafana Loki 13. Managing Grafana
14. Organizing Dashboards 15. Managing Permissions for Users and Teams 16. Authentication with External Services 17. Cloud Monitoring 18. Other Books You May Enjoy

Installing Grafana

At its core, Grafana runs as a web server, and as such, it is not a typical double-click application. You will need to be comfortable with the command line and have administrator privileges on the computer you plan to install Grafana on. To download the latest versions of Grafana, check out https://grafana.com/grafana/download.

The Grafana application server runs on *nix operating systems (Linux, OS X,and Windows), and it can be installed locally on a laptop or workstation or on a remote server. It is even available as a hosted application if you'd rather not deal with setting up or managing a server application on your own.

In this section, we'll walk through the most typical installation options:

  • Docker
  • OS X
  • Linux
  • Windows
  • Hosted Grafana on the cloud

Once you've completed the installation of your choice, proceed to the Connecting to the Grafana serversectionfor instructions on how to access Grafana from a web browser.

Grafana in a Docker container

The easiest and least complex installation method is to run Grafana from within a Docker container. Docker is available for all major platforms and can be downloaded by visitinghttps://www.docker.com/.

After installing Docker, open a terminal window and type in the following command:

          $ docker run -d --name=grafana -p 3000:3000 grafana/grafana
        

Docker will automatically download and run the latest version of Grafana for your computer's architecture. Bear in mind that since this basic container has no persistent storage, nothing will be retained if you delete the container. I suggest you run the container with a temporary volume so that Grafana's internal database will continue to exist, even if you destroy the container:

          
            $ docker volume create grafana-storage
            
$ docker run -d --name = grafana -p 3000:3000\
-v grafana-storage:/var/lib/grafana \
grafana/grafana

I recommend proceeding with Docker for the purposes of this book as it will allow an almost turnkey installation experience, as all the necessary dependencies will be automatically downloaded with the container. It will also install in its own sandbox, so you don't need to worry about installing a stack of software that will be difficult to delete later. Finally, in future chapters we will be setting up data sources using similar Docker containers, so managing the data pipeline as a combination of containers will be very consistent and straightforward.

Grafana for OS X

There are two options for installing and running Grafana for OS X:

  • Homebrew
  • The command line

Using Homebrew is the simplest option as it wraps all the installation chores in a single command. To get Homebrew, visit https://brew.sh/. If you want more control over where to install Grafana, the command line option is a better choice.

Homebrew

To install via Homebrew, use the following:

          $ brew install grafana
        

If you want to keep Grafana running even after a reboot, use theservices subcommand to launch the installed Grafana application as a service. You will first need to confirm services installation:

          $ brew tap homebrew/services
          
$ brew services start grafana

The command line

To install via the command line, open a Terminal shell window and download an OS X distribution tarball, thenuntarit into the directory of your choice (replace $GRAFANA_VERSION with the current version):

          $ wget https://dl.grafana.com/oss/release/grafana-$GRAFANA_VERSION.darwin-amd64.tar.gz 
          
$ tar -zxvf grafana-$GRAFANA_VERSION.darwin-amd64.tar.gz

Once you'veuntared the file,cdinto the directory and launch the binary:

./bin/grafana-server web

Grafana for Linux

Linux comes in a number of flavors and each has a slightly different installation system. Typically, you download the binary and then run the installer on the package file. To get the latest Grafana binaries for Linux, visit https://grafana.com/grafana/download?platform=linux.

RedHat Linux

The installer for the RedHat distributions (CentOS, RedHat, and Fedora) isyum. To download and install (replacing $GRAFANA_VERSION with the current version), use the following:

          $ wget https://dl.grafana.com/oss/release/grafana-$GRAFANA_VERSION.x86_64.rpm
          
$ sudo yum install initscripts urw-fonts
$ sudo yum localinstall grafana-$GRAFANA_VERSION.x86_64.rpm

To start up Grafana, usesystemd:

          $ systemctl daemon-reload
          
$ systemctl start grafana-server
$ systemctl status grafana-server

To keep Grafana running even after a reboot, use the following:

          $ sudo systemctl enable grafana-server.service
        

Debian Linux

The installer for the Debian distributions (Debian and Ubuntu) isdpkg. To download and install (replace $GRAFANA_VERSION with the current version), use the following:

          $ wget https://dl.grafana.com/oss/release/grafana_$GRAFANA_VERSION_amd64.deb
          
$ sudo apt-get install -y adduser libfontconfig1
$ sudo dpkg -i grafana_$GRAFANA_VERSION_amd64.deb

To start up Grafana, use the following:

          $ systemctl daemon-reload
          
$ systemctl start grafana-server
$ systemctl status grafana-server

To keep Grafana running even after a reboot, use the following:

          $ sudo systemctl enable grafana-server.service
        

Grafana for Windows

Installation for Windows is straightforward:

  1. Go to https://grafana.com/grafana/download?platform=windows.
  2. Download the latest MSI installer file from the download link.
  3. Launch the.msifile to install.

Hosted Grafana on the cloud

If you would rather not install Grafana on your computer, or you don't have access to a computer that can run Grafana, there is another option—Grafana can host a free instance for you. There are restrictions—namely that in order to access a data source, you will need to upgrade a paid subscription—but if you want to follow this book up to the point where we use data sources, hosted Grafana might be a good solution. To sign up for the hosted version, go to https://grafana.com/get and select the link under We Host It.

You have been reading a chapter from
Learn Grafana 7.0
Published in: Jun 2020
Publisher: Packt
ISBN-13: 9781838826581
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime