Skip to content
Lei Zhang edited this page Mar 7, 2017 · 2 revisions

Building Grafana v4.1.2

Grafana is the tool for monitoring and metric analytics & dashboards for Graphite, InfluxDB & Prometheus & More http://grafana.org. The instructions provided below specify the steps to build Grafana v4.1.2 on IBM z Systems for Ubuntu 16.04, RHEL 7.3 and SLES 12 SP2:

General Note:

  • When following the steps below please use a super permission user unless otherwise specified
  • A directory <source root> will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it

Building and Installing Grafana v4.1.2

Step 1: Install the dependencies

  • Ubuntu 16.04

    apt-get update
    apt-get install wget python openjdk-8-jdk
    
  • RHEL 7.3

    yum update
    yum install java-1.8.0-openjdk
    
  • SLES 12 SP2

    zypper update
    zypper install java-1_8_0-openjdk git
    

Install Nodejs v4+

wget http://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/nodejs/6.10.0.0/linux/s390x/ibm-6.10.0.0-node-v6.10.0-linux-s390x.bin
chmod +x ibm-6.10.0.0-node-v6.10.0-linux-s390x.bin
./ibm-6.10.0.0-node-v6.10.0-linux-s390x.bin
export PATH=$PATH:/root/ibm/node/bin

Install Go 1.7.4

Follow the recipe in https://github.com/linux-on-ibm-z/docs/wiki/Building-Go to install Golang, remember to set your GOPATH

Step 2: Build Grafana backend

mkdir -p $GOPATH/src/github.com/grafana
cd $GOPATH/src/github.com/grafana
git clone https://github.com/grafana/grafana.git
cd grafana
git checkout v4.1.2

Make changes to vendor/github.com/klauspost/compress/gzip/gunzip.go

@@ -14,7 +14,7 @@ import (
        "time"

        "github.com/klauspost/compress/flate"
-       "github.com/klauspost/crc32"
+       "hash/crc32"
)

Make changes to vendor/github.com/klauspost/compress/gzip/gzip.go

@@ -11,7 +11,7 @@ import (
        "io"

        "github.com/klauspost/compress/flate"
-       "github.com/klauspost/crc32"
+       "hash/crc32"
)

Then

make deps-go
make build-go

Then the binary grafana-server and grafana-cli will be put at $GOPATH/src/github.com/grafana/grafana/bin

Step 3: Build Grafana frontend assets

Install PhantomJS

Install yarn

cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz
export PATH=$PATH:/opt/dist/bin

Install grunt

cd $GOPATH/src/github/grafana/grafana
npm install grunt

Then

make deps-js
make build-js

Step 4: Testing (Optional)

Test backend

make test-go

Backend tests should all pass

Test frontend

make test-js

There would be a failure on "karma:test", but this failure can be neglected since it happens between the javascript test runner and the browser chosen, which are both independent from Grafana itself. Therefor, it won't affect the installation and use of Grafana.