Building Kibana - linux-on-ibm-z/docs GitHub Wiki

Building Kibana

The instructions provided below specify the steps to install Kibana 9.3.0 on Linux on IBM Z for following distributions:

  • RHEL (8.10, 9.4, 9.6, 9.7)
  • SLES (15 SP7)
  • Ubuntu (22.04, 24.04)

General Notes:

  • 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.

1. Build using script

If you want to build Kibana using manual steps, go to STEP 2.

Use the following commands to build Kibana using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kibana/9.3.0/build_kibana.sh

# Build Kibana
bash build_kibana.sh

If the build completes successfully, go to STEP 6. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

2. Install Dependencies

export SOURCE_ROOT=/<source_root>/
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kibana/9.3.0/patch"

2.1. Install Basic Dependencies

  • RHEL (8.10, 9.4, 9.6, 9.7)

    PYVER="3" # only for rhel9.x
    PYVER="39" # only for rhel8.x
    export npm_config_python="/usr/bin/python3.9" # only for rhel8.x
    export PYTHON="/usr/bin/python3.9" # only for rhel8.x
    sudo dnf install -y --allowerasing curl git gcc-c++ gzip make python${PYVER} java-21-openjdk-devel unzip zip tar wget patch xz pkg-config expat-devel glib2-devel meson ninja-build brotli cmake clang clang-devel llvm-devel perl coreutils ed expect file gnupg2 iproute iputils less openssl-devel python${PYVER}-devel python${PYVER}-pip python${PYVER}-requests python${PYVER}-setuptools python${PYVER}-six python${PYVER}-wheel python${PYVER}-pyyaml zlib-devel
  • SLES (15 SP7)

    sudo zypper install -y curl git gcc-c++ gcc14-c++ gzip make python311 java-21-openjdk-devel unzip zip tar wget patch xz which gawk pkg-config glib2-devel libexpat-devel cmake meson ninja gobject-introspection-devel procps coreutils ed expect file iproute2 iputils less libopenssl-devel python311-devel python311-pip python311-requests cmake clang llvm-clang-devel python311-setuptools python311-six python311-wheel unzip zlib-devel python311-python-gnupg python311-PyYAML
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 50
    sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-14 50
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 50
    export npm_config_python="/usr/bin/python3.11"
    export PYTHON="/usr/bin/python3.11"
  • Ubuntu (22.04, 24.04)

    sudo apt-get update
    sudo apt-get install -y curl git gzip make python3 python-is-python3 unzip zip tar wget patch xz-utils cmake libclang-dev clang build-essential pkg-config libglib2.0-dev libexpat1-dev meson ninja-build brotli libgirepository1.0-dev

2.2. Set JAVA_HOME environment variable

export JAVA_HOME=<path to java>
export PATH=$JAVA_HOME/bin:$PATH

2.3. Install Node.js

cd $SOURCE_ROOT
export NODE_JS_VERSION="22.22.0"
sudo mkdir -p /usr/local/lib/nodejs
wget https://nodejs.org/dist/v$NODE_JS_VERSION/node-v$NODE_JS_VERSION-linux-s390x.tar.xz
sudo tar xf node-v$NODE_JS_VERSION-linux-s390x.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-v$NODE_JS_VERSION-linux-s390x/bin:$PATH

2.4. Install Yarn

sudo chmod ugo+w -R /usr/local/lib/nodejs/node-v${NODE_JS_VERSION}-linux-s390x
npm install -g yarn

2.5. Install brotli (Only on SLES 15 SP7)

cd $SOURCE_ROOT
git clone --depth 1 -b v1.1.0 https://github.com/google/brotli.git
cd brotli
mkdir out && cd out
cmake -DCMAKE_BUILD_TYPE=Release .. #need cmake 3.15+
sudo cmake --build . --config Release --target install
export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

2.6. Install MoonRepo

cd $SOURCE_ROOT
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo --version

cd $SOURCE_ROOT
git clone -b v1.41.7 https://github.com/moonrepo/moon
cd moon
cargo fetch
sed -i 186,187d $HOME/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/extism-convert-1.12.0/src/encoding.rs 
cargo build --workspace
sudo cp target/debug/moon /usr/local/bin/moon
export PATH="/usr/local/bin":$PATH 
moon --version

3. Build and Install Kibana

  • Download Kibana

    cd $SOURCE_ROOT
    git clone --depth 1 -b v9.3.0 https://github.com/elastic/kibana.git
    cd kibana
  • Apply source code patch:

    cd $SOURCE_ROOT/kibana
    curl -sSL $PATCH_URL/kibana_patch.diff | git apply
    sed -i '95s/0.34.4/0.34.3/;2043s/0.34.4/0.34.3/' package.json # only on rhel and ubuntu:22.04
  • Bootstrap Kibana

    export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
    export RUST_MIN_STACK=$((32 * 1024 * 1024))
    export MOON_DISABLE_NATIVE=1
    export MOON_BINARY_PATH=/usr/local/bin/moon
    yarn kbn bootstrap --network-timeout 1000000
    # If build fail on this then use `yarn kbn bootstrap --force-install`
  • Build Kibana

    cd $SOURCE_ROOT/kibana
    export NODE_OPTIONS="--max_old_space_size=8192"
    node scripts/build --release --skip-os-packages

4. Test (Optional)

4.1. Build the Elasticsearch Distribution

cd $SOURCE_ROOT
mkdir -p "$SOURCE_ROOT/elasticsearch"
cd "$SOURCE_ROOT/elasticsearch"
curl -sSL "https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Elasticsearch/9.3.0/build_elasticsearch.sh" > build_elasticsearch.sh
sed -i '48,77d;182,194d;235,249d' ./build_elasticsearch.sh
bash ./build_elasticsearch.sh -y -k

4.2. Build and Install ParcelWatcher

cd $SOURCE_ROOT
git clone --depth 1 -b v2.5.1 https://github.com/parcel-bundler/watcher.git
cd watcher
yarn --frozen-lockfile --ignore-scripts
npm install node-gyp -g
yarn prebuild --arch s390x -t 22.0.0
mkdir -p "${SOURCE_ROOT}/kibana/node_modules/@parcel/watcher-linux-s390x-glibc/"
cp build/Release/obj.target/watcher.node "${SOURCE_ROOT}/kibana/node_modules/@parcel/watcher-linux-s390x-glibc/"
cat << "EOF" > "${SOURCE_ROOT}/kibana/node_modules/@parcel/watcher-linux-s390x-glibc/package.json"
{
  "name": "@parcel/watcher-linux-s390x-glibc",
  "version": "2.5.1",
  "main": "watcher.node",
  "repository": {
    "type": "git",
    "url": "https://github.com/parcel-bundler/watcher.git"
  },
  "description": "A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.",
  "license": "MIT",
  "publishConfig": {
    "access": "public"
  },
  "funding": {
    "type": "opencollective",
    "url": "https://opencollective.com/parcel"
  },
  "files": [
    "watcher.node"
  ],
  "engines": {
    "node": ">= 10.0.0"
  },
  "os": [
    "linux"
  ],
  "cpu": [
    "s390x"
  ],
  "libc": [
    "glibc"
  ]
}
EOF

4.3. Build and Install Selenium (Only on RHEL)

sudo dnf install -y firefox
sudo dnf -y groupinstall 'Development Tools'
mkdir -p "$SOURCE_ROOT/selenium"
cd "$SOURCE_ROOT/selenium"
git clone --depth=1 -b FIREFOX_128_14_0esr_RELEASE https://github.com/mozilla-firefox/firefox.git
cd firefox/testing/geckodriver/
cargo build
../../target/debug/geckodriver --version
sudo cp ../../target/debug/geckodriver /usr/local/bin/

cd "$SOURCE_ROOT/selenium"
git clone --depth=1 -b selenium-4.34.0 https://github.com/SeleniumHQ/selenium.git
cd selenium/rust
cargo build
./target/debug/selenium-manager --version
cp ./target/debug/selenium-manager "$SOURCE_ROOT"/kibana/node_modules/selenium-webdriver/bin/linux/selenium-manager

4.4. Build and Install Sharp (Only on RHEL 8.x)

cd $SOURCE_ROOT
git clone -b v0.33.4 https://github.com/lovell/sharp.git
cd sharp
npm install --build-from-source
cd $SOURCE_ROOT/kibana/node_modules/@img
cp -r $SOURCE_ROOT/sharp/node_modules/@img/sharp-linux-s390x .
cp -r $SOURCE_ROOT/sharp/node_modules/@img/sharp-libvips-linux-s390x .

4.5. Set Test Environment

export NODE_OPTIONS="--max-old-space-size=8192"
export TEST_BROWSER_HEADLESS=1
export DISABLE_BOOTSTRAP_VALIDATION=true
export BROWSERSLIST_IGNORE_OLD_DATA=true
export KBN_ES_SNAPSHOT_URL="$SOURCE_ROOT/elasticsearch/elasticsearch/distribution/archives/linux-s390x-tar/build/distributions/elasticsearch-9.3.0-SNAPSHOT-linux-s390x.tar.gz"

4.6. Build Kibana Platform Plugins

cd $SOURCE_ROOT/kibana
node scripts/build_kibana_platform_plugins

4.7. Run the Tests

  • Unit tests

    cd $SOURCE_ROOT/kibana
    wget $PATCH_URL/unittest.sh
    bash unittest.sh
  • Integration tests

    cd $SOURCE_ROOT/kibana
    wget $PATCH_URL/integrationtest.sh
    bash integrationtest.sh
  • Functional tests

    cd $SOURCE_ROOT/kibana
    wget $PATCH_URL/functionaltest.sh
    bash functionaltest.sh

Notes:

  • The following test case failures can be ignored as they are seen on x86 also:

    src/platform/packages/shared/kbn-test/jest.config.js
    node_modules/@elastic/ems-client/jest.config.js
    node_modules/@elastic/ecs/jest.config.js
    node_modules/@elastic/node-crypto/jest.config.js
    node_modules/@n8n/json-schema-to-zod/jest.config.js
    node_modules/@searchkit/sdk/jest.config.js
    node_modules/redux-saga-testing/jest.config.js
    node_modules/sass-embedded/dist/jest.config.js
    node_modules/tsconfig-paths-webpack-plugin/jest.config.js
    src/core/server/integration_tests/ci_checks/jest.integration.config.js
    src/core/server/integration_tests/elasticsearch/jest.integration.config.js
    x-pack/platform/plugins/shared/fleet/jest.integration.config.js
    src/platform/test/api_integration/config.js
    src/platform/test/server_integration/http/platform/config.ts
    x-pack/platform/test/fleet_api_integration/config.agent_policy.ts
    x-pack/platform/test/fleet_api_integration/config.epm.ts
    x-pack/platform/test/fleet_api_integration/config.event_ingested.ts
    x-pack/platform/test/fleet_api_integration/config.fleet.ts
    x-pack/platform/test/fleet_api_integration/config.package_policy.ts
    x-pack/platform/test/fleet_api_integration/config.space_awareness.ts
    x-pack/solutions/observability/test/api_integration/apis/uptime/config.ts
    x-pack/solutions/security/test/fleet_api_integration/config.package_policy.ts

  • The following test case failures can be ignored as they pass if test timeouts are increased:

    src/platform/packages/shared/kbn-es-query/jest.config.js
    src/platform/packages/shared/kbn-unified-data-table/jest.config.js
    x-pack/platform/plugins/private/upgrade_assistant/jest.config.js
    x-pack/platform/plugins/shared/index_management/jest.config.js
    x-pack/platform/plugins/shared/lens/jest.config.js
    x-pack/platform/plugins/shared/stack_connectors/jest.config.js
    x-pack/solutions/observability/packages/kbn-alerts-grouping/jest.config.js
    x-pack/solutions/observability/plugins/slo/jest.config.js
    x-pack/solutions/observability/plugins/synthetics/jest.config.js
    src/core/server/integration_tests/saved_objects/migrations/group1/jest.integration.config.js
    src/core/server/integration_tests/saved_objects/migrations/group2/jest.integration.config.js
    src/core/server/integration_tests/ui_settings/jest.integration.config.js

  • The following test case failures are not related to functionality and can be safely ignored:

    src/dev/build/tasks/nodejs/verify_existing_node_builds_task.test.ts src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts src/dev/build/lib/config.test.ts

  • The following test case failures can be ignored as they require ml support which is not available on s390x:

    x-pack/platform/test/alerting_api_integration/spaces_only/tests/alerting/group2/config.ts
    x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial.ts
    x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.ai_agent.stateful.config.ts
    x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.ai_assistant.stateful.config.ts
    x-pack/solutions/observability/test/api_integration_deployment_agnostic/configs/stateful/oblt.apm.stateful.config.ts
    x-pack/solutions/observability/test/apm_api_integration/trial/config.ts
    x-pack/solutions/observability/test/observability_api_integration/trial/config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/machine_learning/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/common/configs/edge_cases/ess_trial_license.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/customization/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/prebuilt_rules/customization_enabled/upgrade_prebuilt_rules/diffable_rule_fields/type_specific_fields/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_creation/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/telemetry/trial_license_complete_tier/configs/ess.config.ts
    x-pack/solutions/observability/test/functional/config.firefox.ts
    x-pack/platform/test/api_integration/apis/ml/config.ts

  • Selenium test cases which require chromium will fail as chromium is not supported on s390x

  • Selenium test cases which require playwright will fail as playwright is not supported on s390x

  • Some X-Pack test cases will fail as X-Pack plugins are not supported on s390x

  • Some failing test cases pass when executed individually.

5. Install Kibana

cd $SOURCE_ROOT/kibana
sudo mkdir /usr/share/kibana/
sudo tar -xzf target/kibana-9.3.0-linux-s390x.tar.gz -C /usr/share/kibana --strip-components 1
sudo ln -sf /usr/share/kibana/bin/* /usr/bin/

sudo groupadd [username]
sudo chown [username]:elastic -R /usr/share/kibana/

6. Start Kibana

Kibana requires an Elasticsearch instance to be running.

Set Kibana home directory export KIBANA_HOME=/usr/share/kibana/. You may start Kibana and also update the Kibana configuration file $KIBANA_HOME/config/kibana.yml.

kibana

Open your browser and go to https://<HOST_IP>:5601 to make sure the Kibana installation works.

Note:

  • When Kibana is run for the first time, it generates a unique link in your terminal which can be used to enroll your Kibana instance with Elasticsearch. See here for more information on starting Kibana.
  • In order to access Kibana server through web browser, you might need to change server.host field in $KIBANA_HOME/config/kibana.yml to 0.0.0.0. See here for more information.
  • For more information regarding configuring Kibana, please visit here.

References:

⚠️ **GitHub.com Fallback** ⚠️