Skip to content

Building Kibana

aborkar-ibm edited this page Jun 8, 2021 · 52 revisions

Building Kibana

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

  • RHEL (7.8, 7.9, 8.1, 8.2, 8.3)
  • SLES 15 SP2
  • Ubuntu (18.04, 20.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.

Build and Install Kibana

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/7.12.1/build_kibana.sh

# Build Kibana
bash build_kibana.sh

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

2) Install build dependencies

export SOURCE_ROOT=/<source_root>/
  • RHEL (7.8, 7.9)

    sudo yum install -y curl git devtoolset-7-gcc-c++ devtoolset-7-gcc gzip make python3 java-11-openjdk-devel unzip zip tar wget patch xz
    scl enable devtoolset-7 bash
  • RHEL (8.1, 8.2, 8.3)

    sudo yum install -y curl git gcc-c++ gzip make python2 python3 java-11-openjdk-devel unzip zip tar wget patch xz
    sudo ln -sf /usr/bin/python3 /usr/bin/python
  • SLES 15 SP2

    sudo zypper install -y curl git gcc-c++ gzip make python python3 java-11-openjdk-devel unzip zip tar wget patch xz which gawk
  • Ubuntu (18.04, 20.04)

    sudo apt-get update
    sudo apt-get install -y curl git g++ gzip make python python3 openjdk-11-jdk unzip zip tar wget patch xz-utils

3) Set JAVA_HOME environment variable

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

4) Install Bazel

cd $SOURCE_ROOT
mkdir bazel && cd bazel
wget https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-dist.zip
unzip bazel-4.0.0-dist.zip
chmod -R +w .
curl -sSL https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Bazel/4.0.0/patch/bazel.patch | patch -p1
bash ./compile.sh
export PATH=$PATH:$SOURCE_ROOT/bazel/output/

5) Install Latest Go version

  • Instructions for building Go can be found here

6) Build Bazelisk binary

cd $SOURCE_ROOT
git clone https://github.com/bazelbuild/bazelisk.git
cd bazelisk
git checkout v1.7.5
curl -sSL https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kibana/7.12.1/patch/bazelisk_patch.diff | git apply --ignore-whitespace
export USE_BAZEL_VERSION=$SOURCE_ROOT/bazel/output/bazel
go build && ./bazelisk build --config=release //:bazelisk-linux-s390x

7) Install Node.js

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

8) Install Yarn and patch Bazelisk

sudo chmod ugo+w -R /usr/local/lib/nodejs/node-v14.16.1-linux-s390x
npm install -g yarn @bazel/bazelisk@1.7.5
BAZELISK_DIR=/usr/local/lib/nodejs/node-v14.16.1-linux-s390x/lib/node_modules/@bazel/bazelisk
curl -sSL https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kibana/7.12.1/patch/bazelisk.js.diff | patch $BAZELISK_DIR/bazelisk.js
cp $SOURCE_ROOT/bazelisk/bazel-out/s390x-opt-*/bin/bazelisk-linux_s390x $BAZELISK_DIR

9) Build and install Kibana

  • Download Kibana

    cd $SOURCE_ROOT
    git clone https://github.com/elastic/kibana.git
    cd kibana
    git checkout v7.12.1
  • Build re2

    cd $SOURCE_ROOT
    git clone https://github.com/uhop/node-re2.git
    cd node-re2 && git checkout 1.15.4
    git submodule update --init --recursive
    npm install
    gzip -c build/Release/re2.node > $SOURCE_ROOT/linux-s390x-83.gz
    mkdir -p $SOURCE_ROOT/kibana/.native_modules/re2/
    cp $SOURCE_ROOT/linux-s390x-83.gz $SOURCE_ROOT/kibana/.native_modules/re2/
  • Apply source code patch:

    cd $SOURCE_ROOT/kibana
    curl -sSL https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Kibana/7.12.1/patch/kibana_patch.diff | git apply
  • Bootstrap Kibana

    yarn kbn bootstrap --oss
  • Build Kibana

    cd $SOURCE_ROOT/kibana
    export NODE_OPTIONS="--max_old_space_size=4096"
    yarn build --skip-os-packages --oss

10) Test (Optional)

cd $SOURCE_ROOT/kibana
yarn test:jest

Note:

  • The following test case failures can be ignored as they are seen on x86 also. packages/kbn-dev-utils/src/tooling_log/tooling_log_text_writer.test.ts packages/kbn-optimizer/src/optimizer/cache_keys.test.ts packages/kbn-pm/src/utils/link_project_executables.test.ts packages/kbn-pm/src/utils/projects_tree.test.ts packages/kbn-test/src/functional_tests/cli/run_tests/cli.test.js packages/kbn-test/src/functional_tests/cli/start_servers/cli.test.js packages/kbn-test/src/functional_tests/lib/run_cli.test.js src/core/server/logging/layouts/pattern_layout.test.ts src/dev/cli_dev_mode/optimizer.test.ts src/dev/i18n/extract_default_translations.test.js src/dev/i18n/extractors/html.test.js src/dev/i18n/utils/utils.test.js

  • The following test case failures are not related to functionality and can be safely ignored. src/cli_plugin/install/zip.test.js src/dev/build/lib/config.test.ts src/dev/build/tasks/nodejs/download_node_builds_task.test.ts src/dev/build/tasks/nodejs/extract_node_builds_task.test.ts src/dev/build/tasks/nodejs/verify_existing_node_builds_task.test.ts x-pack/plugins/reporting/server/export_types/printable_pdf/lib/pdf/index.test.ts x-pack/plugins/reporting/server/routes/diagnostic/browser.test.ts

11) Install Kibana

cd $SOURCE_ROOT/kibana
sudo mkdir /usr/share/kibana/
sudo tar -xzf target/kibana-oss-7.12.1-SNAPSHOT-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]:[username] -R /usr/share/kibana/

12) 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:

  • 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

https://www.elastic.co/products/kibana

Clone this wiki locally