Installing Grafana v8.1.7 from source code on zLinux (s390x)

7/16/2022 0 Comments

In this article we see how to install Grafana v8.1.7 from source code on zLinux (s390x). By obtaining from source code we can do customizations to Grafana such as adding more themes, behaviors etc. Even though this article says zLinux the below steps should generally work for all flavors of Linux such as Ubuntu, Redhat,  CentOS etc. Also it is important to note that these instructions work only till Grafana v8.2.7 specifically in zLinux because after Grafana v3 and above some breaking changes have been made to the build process and as of writing this article these breaking changes have not been fixed for zLinux. Other distributions just work fine.

Build the Grafana Server

PRE-REQUISITES

  1. Create a working directory (hereafter called <work_dir>) for Grafana (In this example it is in ~/software/grafana_v8)
  2. Ensure make is installed by executing: make --version. If make is not installed please install it.
  3. GoLang Compiler (v1.17.1 or later): Ensure go is installed by executing: go version (If not installed follow this article to install GoLang v1.17.1 to folder /usr/local/go)
  4. Specify the following 'env' variables:
    export GO111MODULE=on
    export GOPATH=~/software/go-path (create this directory if required)
    export GOROOT=/usr/local/go (assuming go is installed here)
    export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
  5. NodeJS (v16.15.1) and Yarn (v1.22.19):  Ensure NodeJS and Yarn are installed by executing: node --version && yarn --version  (If not installed follow this article to install NodeJS v16.15.1)
  6. Execute the following:
    1. export PATH=$PATH:~/software/<node_install_dir>/bin
    2. export NODE_OPTIONS="--max-old-space-size=8192"

GET THE SOURCE CODE and INSTALL THE SERVER

From the <work_dir> download the source code of Grafana v8.1.7 using: 

wget https://github.com/grafana/grafana/archive/refs/tags/v8.1.7.tar.gz

Extract it to the current directory (hereafter referred to as <grafana_root>) with:

sudo tar -C . -xzf v8.1.7.tar.gz

- Go to the path: <grafana_root> and execute: make run (this will install server)
- Once the server starts at port 3000, stop the server (press Cntrl+C) and proceed to next step

INSTALL AND START CLIENT

From the directory <grafana_root> execute the following (this might take a while to complete say a few minutes):
yarn install --pure-lockfile - this will install client dependencies
yarn start - this will build the client and start it. Once the client has started stop it (press Cntrl+C) and proceed to next step.

START THE SERVER

  • (Optional Step) If you want to change the default Grafana port (3000), edit <grafana_root>/conf/default.ini and change the <http_port> value.
  • Change directory to <grafana_root>/bin directory and execute: ./grafana-server - This will run the server at port <http_port> (default 3000). 
  • DONE!!! Open http://<server>:<port> in a browser to see the Grafana login screen. The default username, pwd is admin, admin respectively.

Thank you and happy metrics visualization!!!

0 comments:

Blog Archive