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

Building Elasticsearch

Below versions of Elasticsearch are available in respective distributions at the time of creation of these build instructions.

The instructions provided below specify the steps to build Elasticsearch version 9.4.3 on Linux on IBM Z for following distributions:

  • RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
  • SLES (15 SP7)
  • Ubuntu (22.04, 24.04)

Prerequisites:

  • Docker packages are provided for RHEL, SLES and Ubuntu in their respective repositories. More information about Docker CE can be found here

  • Ensure the current user belongs to group docker:

    Use the below command to add group docker if it does not exist:

    sudo groupadd docker

    Use the below command to add current user to group docker if it has not been done:

    sudo usermod -aG docker $USER && newgrp docker
  • Docker Compose is required for some elasticsearch integration tests. Docker Compose should be installed on all platforms where it is available if the integration tests are going to be run.

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 Elasticsearch using manual steps, go to STEP 2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Elasticsearch/9.4.3/build_elasticsearch.sh

# Build Elasticsearch
bash build_elasticsearch.sh  [Provide -t option for executing build with tests]

By default the script builds s390x ml-cpp first, stages the required deps and nodeps zip artifacts in an Ivy-style repository at /tmp/mlcpp-ivy, and then builds Elasticsearch with -Dbuild.ml_cpp.repo=file:///tmp/mlcpp-ivy. To stage the generated artifacts in a different local repository, run:

ML_CPP_REPO=/<mlcpp-ivy-repo> bash build_elasticsearch.sh

To build ml-cpp from a different source or ref, set ML_CPP_REPO_URL and ML_CPP_REF:

ML_CPP_REPO_URL=<ml-cpp-git-url> ML_CPP_REF=<ml-cpp-ref> bash build_elasticsearch.sh

The s390x ml-cpp build requires PyTorch/libtorch 2.7.1. The script first looks for an existing PyTorch in the auto-detected locations ($ML_CPP_SOURCE_DIR/deps/pytorch-gcc13, $SOURCE_ROOT/deps/pytorch-gcc13, $SOURCE_ROOT/pytorch-gcc13, /usr/local/gcc133, /opt/pytorch-gcc13, or /usr/local/pytorch-gcc13). If none is found, it clones PyTorch and builds libtorch from source before building ml-cpp.

To reuse an existing PyTorch build instead of rebuilding it:

ML_PYTORCH_ROOT=/<pytorch-install> bash build_elasticsearch.sh

If the build completes successfully, go to STEP 9. 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>/
export GRADLE_USER_HOME=$SOURCE_ROOT/.gradle
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Elasticsearch/9.4.3/patch"
export ML_CPP_PATCH_URL_BASE="$PATCH_URL"
export ML_CPP_PATCH_URL="${ML_CPP_PATCH_URL_BASE}/ml-cpp.patch"
export ML_CPP_PATCH_DIR="$SOURCE_ROOT/ml-cpp-patches"
export PATCH_DIR="$ML_CPP_PATCH_DIR"
export ML_CPP_REPO=/tmp/mlcpp-ivy
export ML_CPP_GRADLE_OPTS="-Dbuild.ml_cpp.repo=file://$ML_CPP_REPO"
export ML_CPP_REF=v9.4.3
export ML_CPP_SOURCE_DIR=$SOURCE_ROOT/ml-cpp
export ML_CPP_JAVA_HOME=/opt/java/jdk17
export ML_CPP_BOOST_ROOT=/usr/local/gcc133
export ML_CPP_BOOST_SOURCE_DIR=$SOURCE_ROOT/boost_1_86_0
export ML_CPP_BUILD_PARALLEL_LEVEL=4
export ML_PYTORCH_REF=v2.7.1
export ML_PYTORCH_SOURCE_DIR=$SOURCE_ROOT/pytorch
export ML_PYTORCH_BUILD_PARALLEL_LEVEL=4
export ML_PYTORCH_SUBMODULE_JOBS=1
export PYTHON_BIN=python3
export DOCKER_BUILDKIT=0
export DOCKER_BUILD_NETWORK_OPTS="${DOCKER_BUILD_NETWORK_OPTS:---network=host}"
  • RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)

    sudo yum install -y curl git gzip tar wget patch make gcc gcc-c++ bzip2 zip unzip zlib-devel libxml2-devel python3 python3-devel python3-pip cmake ninja-build
    sudo yum install -y gcc-toolset-13-gcc gcc-toolset-13-gcc-c++ || true
    
    # On RHEL 8.10 only
    sudo yum install -y python39 python39-devel python39-pip || true
    command -v python3.9 >/dev/null 2>&1 && export PYTHON_BIN="${PYTHON_BIN:-python3.9}"
  • SLES (15 SP7)

    sudo zypper install -y curl git gzip tar wget patch make gcc gcc-c++ fontconfig dejavu-fonts gawk bzip2 zip unzip zlib-devel libxml2-devel libexpat1 python3 python3-devel python3-pip cmake ninja
    sudo zypper install -y python311 python311-devel python311-pip || true
    command -v python3.11 >/dev/null 2>&1 || sudo zypper install -y python39 python39-devel python39-pip || true
    sudo zypper install -y gcc14 gcc14-c++ libstdc++6-devel-gcc14 || true
    
    for python_candidate in python3.11 python3.10 python3.9 python3; do
        if command -v "$python_candidate" >/dev/null 2>&1 && "$python_candidate" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 8) else 1)' >/dev/null 2>&1; then
            export PYTHON_BIN="${PYTHON_BIN:-$python_candidate}"
            break
        fi
    done
    
    if command -v gcc-14 >/dev/null 2>&1 && command -v g++-14 >/dev/null 2>&1; then
        export CC="$(command -v gcc-14)" CXX="$(command -v g++-14)"
        export CMAKE_C_COMPILER="$CC" CMAKE_CXX_COMPILER="$CXX"
    fi
  • Ubuntu (22.04, 24.04)

    sudo apt-get update
    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl git gzip tar wget patch locales make gcc g++ bzip2 zip unzip zlib1g-dev libxml2-dev python3 python3-dev python3-pip cmake ninja-build
    sudo locale-gen en_US.UTF-8

3. Install Java

  • With Eclipse Adoptium Temurin Runtime (for building Elasticsearch, runtime and test)
    • Download and install Eclipse Adoptium Temurin Runtime (Java 21) from here.

Note: At the time of creation of these build instructions, Elasticsearch was verified with Eclipse Adoptium Temurin Runtime (Java 21 build 21.0.9+10)

4. Set the environment variables

export LANG="en_US.UTF-8"
export JAVA_HOME=<Path to JDK>
export ES_JAVA_HOME=/<Path to JDK>/
export PATH=$ES_JAVA_HOME/bin:$PATH

Note: Ensure system locale is set up correctly for Elasticsearch to build without encoding errors.

5. Build Prerequite Projects

5.1 Build ml-cpp Ivy repository for s390x ML native code

Elasticsearch resolves ML native binaries from the build.ml_cpp.repo Gradle property. The patched ml-cpp helper installs Java 17 for ml-cpp, builds Boost 1.86, builds or reuses PyTorch/libtorch 2.7.1, builds the s390x ml-cpp artifacts, and stages the deps and nodeps zip artifacts in an Ivy-style repository.

cd $SOURCE_ROOT
mkdir -p "$SOURCE_ROOT/logs"
export PACKAGE_VERSION=9.4.3
export LOG_FILE="$SOURCE_ROOT/logs/elasticsearch-9.4.3-$(date +"%F-%T").log"
export BUILD_ENV="$HOME/setenv.sh"
touch "$BUILD_ENV"

# Install Python packages used by the ml-cpp/PyTorch build.
pip_user_opts=(--user)
"$PYTHON_BIN" -m pip install --help | grep -q -- '--break-system-packages' && pip_user_opts+=(--break-system-packages)
"$PYTHON_BIN" -m pip install "${pip_user_opts[@]}" --upgrade pip setuptools wheel cython 'scikit-build<0.18'
"$PYTHON_BIN" -m pip install "${pip_user_opts[@]}" pyyaml typing_extensions numpy ninja cmake cffi sympy networkx jinja2 fsspec filelock cython
export PATH="$HOME/.local/bin:$PATH"

# Clone and patch ml-cpp.
rm -rf "$ML_CPP_SOURCE_DIR"
git clone --depth 1 -b "$ML_CPP_REF" https://github.com/elastic/ml-cpp "$ML_CPP_SOURCE_DIR"
mkdir -p "$ML_CPP_PATCH_DIR"
curl -sSL "$ML_CPP_PATCH_URL" -o "$SOURCE_ROOT/ml-cpp.patch"
cd "$ML_CPP_SOURCE_DIR"
git apply "$SOURCE_ROOT/ml-cpp.patch"
chmod +x s390x/build_ml_cpp.sh

# Build and stage ml-cpp artifacts.
export SOURCE_ROOT PATCH_URL PATCH_DIR ML_CPP_PATCH_URL ML_CPP_PATCH_URL_BASE ML_CPP_PATCH_DIR LOG_FILE BUILD_ENV
export ML_CPP_REPO_URL=https://github.com/elastic/ml-cpp
export ML_CPP_REF ML_CPP_REPO ML_CPP_SOURCE_DIR ML_CPP_JAVA_HOME ML_CPP_BOOST_ROOT ML_CPP_BOOST_SOURCE_DIR ML_CPP_BUILD_PARALLEL_LEVEL
export ML_PYTORCH_REF ML_PYTORCH_SOURCE_DIR ML_PYTORCH_BUILD_PARALLEL_LEVEL ML_PYTORCH_SUBMODULE_JOBS PYTHON_BIN
[[ -n "${CMAKE_C_COMPILER:-}" ]] && export CMAKE_C_COMPILER
[[ -n "${CMAKE_CXX_COMPILER:-}" ]] && export CMAKE_CXX_COMPILER
bash "$ML_CPP_SOURCE_DIR/s390x/build_ml_cpp.sh"
export ML_CPP_GRADLE_OPTS="-Dbuild.ml_cpp.repo=file://$ML_CPP_REPO"

The verified layout is:

$ML_CPP_REPO/maven/org/elasticsearch/ml/ml-cpp/9.4.3-SNAPSHOT/ml-cpp-9.4.3-SNAPSHOT-deps.zip
$ML_CPP_REPO/maven/org/elasticsearch/ml/ml-cpp/9.4.3-SNAPSHOT/ml-cpp-9.4.3-SNAPSHOT-nodeps.zip

5.2 JANSI v2.4.0 for auto-generation of credentials for the elastic user

cd $SOURCE_ROOT
git clone -b jansi-2.4.0 https://github.com/fusesource/jansi.git
cd jansi
make clean-native native OS_NAME=Linux OS_ARCH=s390x

mkdir -p $SOURCE_ROOT/jansi-jar
cd $SOURCE_ROOT/jansi-jar
wget https://repo1.maven.org/maven2/org/fusesource/jansi/jansi/2.4.0/jansi-2.4.0.jar
jar xvf jansi-2.4.0.jar
cd org/fusesource/jansi/internal/native/Linux
mkdir s390x
cp $SOURCE_ROOT/jansi/target/native-Linux-s390x/libjansi.so s390x/
cd $SOURCE_ROOT/jansi-jar
jar cvf jansi-2.4.0.jar .

mkdir -p $SOURCE_ROOT/.gradle/caches/modules-2/files-2.1/org.fusesource.jansi/jansi/2.4.0/321c614f85f1dea6bb08c1817c60d53b7f3552fd/
cp jansi-2.4.0.jar $SOURCE_ROOT/.gradle/caches/modules-2/files-2.1/org.fusesource.jansi/jansi/2.4.0/321c614f85f1dea6bb08c1817c60d53b7f3552fd/
export sha256=$(sha256sum jansi-2.4.0.jar | awk '{print $1}')

5.3 Build osixia/light-baseimage image for osixia/openldap

cd $SOURCE_ROOT
git clone -b v1.2.0 https://github.com/osixia/docker-light-baseimage.git
cd docker-light-baseimage/
curl -sSL "${PATCH_URL}/docker-light-baseimage.patch" | git apply -
make build

5.4 Build osixia/openldap image for openldap-fixture:1.0

cd $SOURCE_ROOT
git clone -b v1.4.0 https://github.com/osixia/docker-openldap.git
cd docker-openldap/
curl -sSL "${PATCH_URL}/docker-openldap.patch" | git apply -
make build

5.5 Build ZSTD v1.5.7 for starting Elasticsearch server

cd $SOURCE_ROOT
export ZSTD_VERSION=1.5.7
wget https://github.com/facebook/zstd/archive/refs/tags/v$ZSTD_VERSION.tar.gz
tar -xzvf v$ZSTD_VERSION.tar.gz
cd zstd-$ZSTD_VERSION
make -j$(nproc) lib
make DESTDIR=$(pwd)/_build install

6. Download Elasticsearch and apply patches

cd $SOURCE_ROOT
git clone --depth=1 -b v9.4.3 https://github.com/elastic/elasticsearch
cd elasticsearch
  • Apply gradle patches to create s390x distribution

    curl -sSL "${PATCH_URL}/elasticsearch.patch" | git apply -
    sed -i -e 's|6cd91991323dd7b2fb28ca93d7ac12af5a86a2f53279e2b35827b30313fd0b9f|'"${sha256}"'|g' \
        -e 's|616491ff68183f90e145b68874627742d796572dbfe4d8dfe64bac22a27864cb|'"${sha256}"'|g' \
        "${SOURCE_ROOT}/elasticsearch/gradle/verification-metadata.xml"
    
    mkdir -p $SOURCE_ROOT/elasticsearch/libs/
    cp -r $SOURCE_ROOT/zstd-$ZSTD_VERSION/_build/usr/local/lib/ $SOURCE_ROOT/elasticsearch/libs/zstd/
    export LD_LIBRARY_PATH=$SOURCE_ROOT/elasticsearch/libs/zstd/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    sudo ldconfig
  • Add libzstd.so object file to native libraries via zstd-1.5.7-linux-s390x.jar file

    cd "$SOURCE_ROOT"
    mkdir -p "$SOURCE_ROOT/zstd-native-dep/artifacts/linux-s390x/"
    cp "$SOURCE_ROOT/zstd-$ZSTD_VERSION/lib/libzstd.so" "$SOURCE_ROOT/zstd-$ZSTD_VERSION/LICENSE" "$SOURCE_ROOT/zstd-native-dep/artifacts/linux-s390x/"
    jar --create --no-manifest --file "$SOURCE_ROOT/zstd-native-dep/zstd-1.5.7-linux-s390x.jar" -C "$SOURCE_ROOT/zstd-native-dep/artifacts/" .
    sed -i "s#%S390X_ZSTD_DEP_DIR%#$SOURCE_ROOT/zstd-native-dep#" "$SOURCE_ROOT/elasticsearch/libs/native/libraries/build.gradle"
  • Since the latest Elasticsearch version has added docker-export files in their repo, we also need to do the same for s390x. So create the following directories:

    mkdir -p $SOURCE_ROOT/elasticsearch/distribution/packages/s390x-rpm/
    mkdir -p $SOURCE_ROOT/elasticsearch/distribution/packages/s390x-deb/
    mkdir -p $SOURCE_ROOT/elasticsearch/distribution/archives/linux-s390x-tar/
    mkdir -p $SOURCE_ROOT/elasticsearch/distribution/docker/docker-s390x-export/
  • Inside each directory create a build.gradle file with the following content -

    // This file is intentionally blank. All configuration of the
    // export is done in the parent project.

7. Build

cd $SOURCE_ROOT/elasticsearch
CPU_NUM="$(grep -c ^processor /proc/cpuinfo)"
export GRADLE_USER_HOME=$SOURCE_ROOT/.gradle
./gradlew --stop >/dev/null 2>&1 || true

ES9_EXCLUDED_TASKS=(
  ":benchmarks:test"
  ":libs:entitlement:bridge:compileMain22Java"
  ":libs:entitlement:bridge:compileMain23Java"
  ":libs:entitlement:compileMain22Java"
  ":libs:entitlement:compileMain23Java"
  ":libs:entitlement:compileMain25Java"
  ":libs:entitlement:compileMain26Java"
  ":libs:entitlement:qa:entitlement-test-plugin:compileMain25Java"
  ":libs:native:compileMain22Java"
  ":libs:simdvec:compileMain22Java"
)
export ES9_OPTS=""
for task in "${ES9_EXCLUDED_TASKS[@]}"; do
    if ./gradlew -q help --task "$task" >/dev/null 2>&1; then
        ES9_OPTS="$ES9_OPTS -x $task"
    fi
done

./gradlew :distribution:archives:linux-s390x-tar:assemble $ES9_OPTS $ML_CPP_GRADLE_OPTS --max-workers="$CPU_NUM" --parallel

8. Testing (Optional)

  • Build Docker image for integration tests

    cd $SOURCE_ROOT/elasticsearch/x-pack/test/idp-fixture/src/main/resources/openldap/
    docker build ${DOCKER_BUILD_NETWORK_OPTS} -f Dockerfile -t docker.elastic.co/elasticsearch-dev/openldap-fixture:1.0 .
    
    cd "$SOURCE_ROOT/elasticsearch/x-pack/test/smb-fixture/src/main/resources"
    docker build ${DOCKER_BUILD_NETWORK_OPTS} -f Dockerfile -t docker.elastic.co/elasticsearch-dev/es-smb-fixture:1.0 .
    
    cd "$SOURCE_ROOT"
    mkdir -p "minio"
    cd "minio"
    wget "https://raw.githubusercontent.com/linux-on-ibm-z/dockerfile-examples/1297255f6d0b235c23b5eae2644fdd65584199a6/Minio/Dockerfile"
    sed -i 's|COPY --from=build /go/bin/curl\* /usr/bin/|COPY --from=build /usr/bin/curl* /usr/bin/|' Dockerfile
    sed -i '/ENV CGO_ENABLED=0/a ENV GODEBUG=http2client=0' Dockerfile
    docker build ${DOCKER_BUILD_NETWORK_OPTS} --build-arg TARGETARCH=s390x --build-arg RELEASE="RELEASE.2025-09-07T16-13-09Z" --build-arg MC_RELEASE="RELEASE.2025-08-13T08-35-41Z" -t  minio/minio:RELEASE.2025-09-07T16-13-09Z --platform=linux/s390x .
  • Run test

    cd $SOURCE_ROOT/elasticsearch
    export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
    export JAVA_HOME=/<Path to JDK>/ # Temurin 21
    export RUNTIME_JAVA_HOME=/<Path to JDK>/ # Only with Temurin 21
    ./gradlew --continue test internalClusterTest -Dtests.haltonfailure=false -Dtests.jvm.argline="-Xss2m" $ES9_OPTS $ML_CPP_GRADLE_OPTS

Notes:

  • Environment variables needed for rerunning tests have been added to $HOME/setenv.sh. To set them, run: source $HOME/setenv.sh
  • If there is a stack overflow error, increase the -Xss value in the command above.
  • :benchmarks:test is excluded on s390x due to Java Vector API SIMD width limitations.
  • The entitlement QA Java 25 compile task is excluded because the build uses Temurin 21 and Gradle toolchain auto-provisioning is disabled.
  • If a test fails because node.processors is greater than the available processor count, rerun it in a container with more CPUs or set the test JVM processor count, for example: -Dtests.jvm.argline="-Xss2m -XX:ActiveProcessorCount=10".
  • For more information regarding Elasticsearch testing, please refer to their testing documentation.
  • User can also create distributions as deb, rpm and docker using below commands.
    ./gradlew :distribution:packages:s390x-deb:assemble $ES9_OPTS $ML_CPP_GRADLE_OPTS
    ./gradlew :distribution:packages:s390x-rpm:assemble $ES9_OPTS $ML_CPP_GRADLE_OPTS
    ./gradlew distribution:docker:docker-s390x-export:exports390xDockerImage $ES9_OPTS $ML_CPP_GRADLE_OPTS

9. Install Elasticsearch

cd $SOURCE_ROOT/elasticsearch
sudo mkdir /usr/share/elasticsearch
sudo tar -xzf distribution/archives/linux-s390x-tar/build/distributions/elasticsearch-9.4.3-SNAPSHOT-linux-s390x.tar.gz -C /usr/share/elasticsearch --strip-components 1

sudo ln -sf /usr/share/elasticsearch/bin/* /usr/bin/

if ! cut -d: -f1 /etc/group | grep -q elastic; then
    sudo /usr/sbin/groupadd elastic
fi
sudo chown "$USER:elastic" -R /usr/share/elasticsearch/

controller_dir=/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-s390x/bin
if [ -f "$controller_dir/controller" ] || [ -f "$controller_dir/controller.bin" ]; then
    if [ ! -f "$controller_dir/controller.bin" ]; then
        sudo mv "$controller_dir/controller" "$controller_dir/controller.bin"
    fi
    sudo tee "$controller_dir/controller" >/dev/null <<'EOF'
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
export LD_LIBRARY_PATH="$DIR/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec -a controller "$DIR/controller.bin" "$@"
EOF
    sudo chmod 0755 "$controller_dir/controller" "$controller_dir/controller.bin"
    sudo chown "$USER:elastic" "$controller_dir/controller" "$controller_dir/controller.bin"
fi

10. Verify Elasticsearch Server

elasticsearch --version

The output should be similar to this:

Version: 9.4.3-SNAPSHOT, Build: tar/45f6a06b1b441b41fe711059b8720013173e7c89/[BUILD_DATE], JVM: 21.0.9

11. Start Elasticsearch Server

ES_LOG="/tmp/elasticsearch-startup.log"
elasticsearch >"$ES_LOG" 2>&1 &
sleep 60
export ELASTIC_PASSWORD="$(awk '/Password for the elastic user/{getline; gsub(/^[[:space:]]+|[[:space:]]+$/, ""); print; exit}' "$ES_LOG")"
[ -n "$ELASTIC_PASSWORD" ] || export ELASTIC_PASSWORD="$(elasticsearch-reset-password -b -u elastic | awk -F': ' '/New value:/{print $2; exit}')"
curl --fail --silent --show-error --cacert /usr/share/elasticsearch/config/certs/http_ca.crt -u elastic:"$ELASTIC_PASSWORD" https://localhost:9200

The curl output should be similar to this:

{
  "name" : "[HOSTNAME]",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "hSgyEtxwQjmRw5YLsIRwqQ",
  "version" : {
    "number" : "9.4.3-SNAPSHOT",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "45f6a06b1b441b41fe711059b8720013173e7c89",
    "build_date" : "[BUILD_DATE]",
    "build_snapshot" : true,
    "lucene_version" : "10.4.0",
    "minimum_wire_compatibility_version" : "8.19.0",
    "minimum_index_compatibility_version" : "8.0.0"
  },
  "tagline" : "You Know, for Search"
}

12. Elasticsearch Docker Image

The docker image of Elasticsearch is formed during the build process.

12.1 Initial Setup

  • Check if the image is formed using the docker images command. The output should have the following repository name and tag:

    REPOSITORY                                            TAG                   
    docker.elastic.co/elasticsearch/elasticsearch         9.4.3-SNAPSHOT
  • temporarily increase the vm.max_map_count kernel parameter to 262144

    sudo sysctl -w vm.max_map_count=262144

12.2 Start a Container

docker run -d --name es_cont -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch:9.4.3-SNAPSHOT

12.3 Environment Setup

  • Copy the CA certificate to your host machine from the container
    docker cp es_cont:/usr/share/elasticsearch/config/certs/http_ca.crt .
  • Extract the password from the container
    docker exec -it es_cont bash -c 'echo "y" | elasticsearch-reset-password -u elastic 2>&1'
    
    # [PASSWORD] can be found in the output of the above command
    export ELASTIC_PASSWORD=[PASSWORD]

12.4 Verify Elasticsearch Server

curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200

The output should be similar to this:

{
  "name" : "eb664268da8f",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Ns22rLNPTUCAcGn29xdwEw",
  "version" : {
    "number" : "9.4.3-SNAPSHOT",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "45f6a06b1b441b41fe711059b8720013173e7c89",
    "build_date" : "2026-07-13T13:41:47.550635060Z",
    "build_snapshot" : true,
    "lucene_version" : "10.4.0",
    "minimum_wire_compatibility_version" : "8.19.0",
    "minimum_index_compatibility_version" : "8.0.0"
  },
  "tagline" : "You Know, for Search"
}

13. Cleanup

cd $SOURCE_ROOT
rm -rf $SOURCE_ROOT/jdk.tar.gz
rm -rf $SOURCE_ROOT/jdk17.tar.gz
rm -rf $SOURCE_ROOT/v1.5.7.tar.gz
rm -rf $SOURCE_ROOT/boost_1_86_0.tar.bz2
rm -rf $SOURCE_ROOT/expat-2.8.1.tar.bz2
rm -rf $SOURCE_ROOT/jansi
rm -rf $SOURCE_ROOT/jansi-jar
rm -rf $SOURCE_ROOT/ml-cpp.patch
rm -rf $SOURCE_ROOT/ml-cpp-patches

Notes:

  • The password for the elastic user can be found in the output of the elasticsearch & command above.
  • On RHEL 9 with OpenJDK 21, it might be necessary to add the command line options --tls-max 1.1 --ciphers DEFAULT@SECLEVEL=0 to the curl command above.

References:

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