Building Grafana - linux-on-ibm-z/docs GitHub Wiki
Below versions of Grafana are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.8, 8.9, 8.10, 9.2, 9.3, 9.4) have
9.2.10
- SLES (15 SP5, 15 SP6) have
9.5.18
The instructions provided below specify the steps to build Grafana 10.4.2 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.9, 8.10, 9.2, 9.3, 9.4)
- SLES (15 SP5, 15 SP6)
- Ubuntu (20.04, 22.04, 24.04)
- When following the steps below please use a standard 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.
If you want to build Grafana using manual steps, go to STEP 2.
Use the following commands to build Grafana using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Grafana/10.4.2/build_grafana.sh
# Build Grafana
bash build_grafana.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 4. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
-
RHEL (8.8, 8.9, 8.10)
sudo yum install -y make gcc gcc-c++ tar wget git git-core patch xz curl python3
-
RHEL (9.2, 9.3, 9.4)
sudo yum install -y --allowerasing make gcc gcc-c++ tar wget git git-core patch xz curl python3
-
SLES (15 SP5, 15 SP6)
sudo zypper install -y make gcc gcc-c++ wget tar git-core xz gzip curl patch python3 libnghttp2-devel
-
Ubuntu (20.04, 22.04, 24.04)
sudo apt-get update sudo apt-get install -y gcc g++ tar wget git make xz-utils patch curl python3 sudo apt-get install -y python3-setuptools ## Only for Ubuntu 24.04
-
Install GO v1.21.4
Instructions for installing Go can be found here
-
Install Nodejs
cd $SOURCE_ROOT source "/etc/os-release" DISTRO="$ID-$VERSION_ID" NODE_JS_VERSION=20.11.1 wget https://nodejs.org/dist/v${NODE_JS_VERSION}/node-v${NODE_JS_VERSION}-linux-s390x.tar.xz chmod ugo+r node-v${NODE_JS_VERSION}-linux-s390x.tar.xz sudo tar -C /usr/local -xf node-v${NODE_JS_VERSION}-linux-s390x.tar.xz export PATH=$PATH:/usr/local/node-v${NODE_JS_VERSION}-linux-s390x/bin node -v
-
Install Yarn
cd $SOURCE_ROOT sudo chmod ugo+w -R /usr/local/node-v20.11.1-linux-s390x npm install -g yarn yarn set version 4.1.0 yarn --version
-
Download Grafana
export GOPATH=$SOURCE_ROOT cd $GOPATH git clone https://github.com/grafana/grafana.git cd grafana git checkout v10.4.2 sed -i '/yarnPath/d' .yarnrc.yml
-
Build Grafana Frontend
cd $GOPATH/grafana yarn install mkdir plugins-bundled/external export NODE_OPTIONS="--max-old-space-size=8192" make build-js
-
Build Grafana Backend
cd $GOPATH/grafana make gen-go make deps-go make build-go
-
Copy Grafana binaries to
/usr/bin
sudo cp $GOPATH/grafana/bin/linux-s390x/grafana /usr/bin/ sudo cp $GOPATH/grafana/bin/linux-s390x/grafana-server /usr/bin/ sudo cp $GOPATH/grafana/bin/linux-s390x/grafana-cli /usr/bin/
- Start Grafana server
grafana server --homepath=<path_to_installed_home_dir_of_grafana>
Note:
-
After starting Grafana server, you can view the Grafana console at
http://<HOST_IP>:<PORT>/
. -
Custom configuration file is located at
$GOPATH/grafana/conf/defaults.ini
& custom configuration file path can be overridden using the --config parameter. -
Plugin
grafana-image-renderer
is not supported on s390x as it uses headless chromium browser which is not supported on s390x
-
Run backend tests
make test-go
-
Run frontend tests
cd $GOPATH/grafana yarn test --watchAll=false
Note:
-
The following error may occur:
"Error: ENOSPC: System limit for number of file watchers reached"
. If it does, you'll need to increase the number of max user watches for inotify. Append or change to a new max in the /etc/sysctl.conf file.echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p # This will check if the value has been changed. cat /proc/sys/fs/inotify/max_user_watches
-
Below test case may fail intermittently. It will pass on rerun
public/app/features/templating/template_srv.test.ts