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.10, 9.2, 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 11.2.0 on Linux on IBM Z for following distributions:
- RHEL (8.8, 8.10, 9.2, 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/11.2.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.10)
sudo yum install -y make gcc gcc-c++ tar wget git git-core patch xz curl python3 procps
-
RHEL (9.2, 9.4)
sudo yum install -y --allowerasing make gcc gcc-c++ tar wget git git-core patch xz curl python3 procps
-
SLES (15 SP5, 15 SP6)
sudo zypper install -y make gcc gcc-c++ wget tar git-core xz gzip curl patch python3
-
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.22.5
Instructions for installing Go can be found here
sudo ln -sf /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc # RHEL and SLES only
-
Download Grafana
export GOPATH=$HOME/go cd $SOURCE_ROOT git clone --depth=1 --single-branch -b v11.2.2 https://github.com/grafana/grafana.git cd grafana git checkout v11.2.2
-
Build Grafana Backend
cd $SOURCE_ROOT/grafana go mod download make build-go
-
Download and install the Grafana distribution to get the pre-built frontend files
cd $SOURCE_ROOT wget https://dl.grafana.com/oss/release/grafana-${PACKAGE_VERSION}.linux-amd64.tar.gz mkdir grafana-dist tar -x -C grafana-dist --strip-components=1 -f grafana-${PACKAGE_VERSION}.linux-amd64.tar.gz rm grafana-dist/bin/* cp grafana/bin/linux-s390x/grafana grafana/bin/linux-s390x/grafana-server grafana/bin/linux-s390x/grafana-cli grafana-dist/bin/
-
Copy Grafana binaries to the
grafana-dist
directorysudo cp $SOURCE_ROOT/grafana/bin/linux-s390x/grafana $SOURCE_ROOT/grafana-dist/bin/ sudo cp $SOURCE_ROOT/grafana/bin/linux-s390x/grafana-server $SOURCE_ROOT/grafana-dist/bin/ sudo cp $SOURCE_ROOT/grafana/bin/linux-s390x/grafana-cli $SOURCE_ROOT/grafana-dist/bin/
-
Start Grafana server
cd $SOURCE_ROOT/grafana-dist ./bin/grafana server
Note:
-
After starting Grafana server, you can view the Grafana console at
http://<HOST_IP>:<PORT>/
[Default port = 3000]. -
Plugin
grafana-image-renderer
is not supported on s390x as it uses headless chromium browser which is not supported on s390x
-
Run backend tests
cd $SOURCE_ROOT/grafana make test-go
-
Run frontend tests
export NODE_JS_VERSION="20.15.1" cd "$SOURCE_ROOT" 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 sudo chmod ugo+w -R /usr/local/node-v${NODE_JS_VERSION}-linux-s390x/ npm install -g yarn yarn set version 4.4.0 yarn --version cd "$SOURCE_ROOT"/grafana yarn install --immutable export NODE_OPTIONS="--max-old-space-size=8192" yarn test --no-watch
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
-
Some test cases may fail intermittently. They will pass on rerun