Skip to content

Building InfluxDB

aborkar-ibm edited this page Jan 27, 2021 · 33 revisions

Building InfluxDB

Below version of InfluxDB is available in respective distributions at the time of creation of these build instructions:

  • Ubuntu 18.04 have 1.1.1
  • Ubuntu 20.04, 20.10 have 1.6.4

The DRAFT instructions provided below specify the steps to build InfluxDB version 2.0.3 on Linux on IBM Z for the following distributions:

  • RHEL (7.8, 7.9, 8.1, 8.2, 8.3)
  • SLES (12 SP5, 15 SP1, 15 SP2)
  • Ubuntu (18.04, 20.04, 20.10)

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 InfluxDB

Step 1: Build using script

If you want to build InfluxDB using manual steps, go to Step 2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/InfluxDB/2.0.3/build_influxdb.sh
# Build InfluxDB
bash build_influxdb.sh   [Provide -t option for executing build with tests]

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

Step 2: Install dependencies

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

    sudo subscription-manager repos --enable rhel-7-server-for-system-z-devtools-rpms
    
    sudo yum install -y git gcc gcc-c++ wget bzr protobuf tar curl patch pkgconfig make llvm-toolset-7
    
    scl enable llvm-toolset-7 bash
    export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/usr/lib64
    clang --version
  • RHEL (8.1, 8.2, 8.3)

    sudo yum install -y clang git gcc gcc-c++ wget protobuf tar curl patch pkg-config make nodejs python38
    
    sudo ln -sf /usr/bin/python3 /usr/bin/python
  • SLES (12 SP5)

    sudo zypper install -y git gcc7 gcc7-c++ wget bzr protobuf-devel tar gzip curl patch pkg-config nodejs10 make bzip2 cmake libarchive13 libopenssl-devel unzip zip
    
    sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-7 40
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 40
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 40
    sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 40
    
    sudo /sbin/ldconfig
    gcc --version
  • SLES (15 SP1, 15 SP2)

    sudo zypper install -y git gcc gcc-c++ wget bzr protobuf-devel tar gzip curl patch pkg-config nodejs10 make clang
  • Ubuntu 18.04

    sudo apt-get install clang git gcc g++ wget bzr protobuf-compiler libprotobuf-dev curl pkg-config make
  • Ubuntu 20.04, 20.10

    sudo apt-get install clang git gcc g++ wget bzr protobuf-compiler libprotobuf-dev curl pkg-config make nodejs
  • Install CMake (SLES 12 SP5 only)

    cd $SOURCE_ROOT
    wget https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2.tar.gz
    tar -xzf cmake-3.19.2.tar.gz
    cd cmake-3.19.2
    ./bootstrap
    make
    sudo make install
    hash -r
  • Install Clang (SLES 12 SP5 only)

    git clone https://github.com/llvm/llvm-project.git
    cd llvm-project
    git checkout llvmorg-11.0.1
    mkdir build
    cd build
    cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
    make
    sudo make install
    clang -v
  • Install NodeJS (RHEL 7.x and Ubuntu 18.04 only)

    NODE_VERSION=v14.15.4
    NODE_DISTRO=linux-s390x
    wget https://nodejs.org/download/release/${NODE_VERSION}/node-${NODE_VERSION}-linux-s390x.tar.xz
    sudo mkdir -p /usr/local/lib/nodejs
    sudo tar -xJf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs
    export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
  • Install bzr (RHEL 8.x only)

    wget https://launchpad.net/bzr/2.7/2.7.0/+download/bzr-2.7.0.tar.gz
    tar zxf bzr-2.7.0.tar.gz
    export PATH=$PATH:$HOME/bzr-2.7.0
  • Install Yarn

    curl -o- -L https://yarnpkg.com/install.sh | bash
    export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
  • Install Rust

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
    source $HOME/.cargo/env
  • Install Go 1.15.6

    wget https://golang.org/dl/go1.15.6.linux-s390x.tar.gz
    sudo tar -C /usr/local -xzf go1.15.6.linux-s390x.tar.gz
    export PATH=/usr/local/go/bin:$PATH
    export PATH=$(go env GOPATH)/bin:$PATH
    
    # RHEL/SLES only
    sudo ln /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc

Step 3: Build and install InfluxDB

  • Install pkg-config

    cd $SOURCE_ROOT
    export GO111MODULE=on
    go get github.com/influxdata/pkg-config
    which -a pkg-config
  • Download and patch Apache Arrow

    cd $SOURCE_ROOT
    git clone https://github.com/apache/arrow.git
    cd arrow/go/arrow
    git checkout ac86123a3f013ba1eeac2b66c2ccd00810c67871
    
    wget -O $SOURCE_ROOT/arrow.patch https://github.com/apache/arrow/commit/aca707086160afd92da62aa2f9537a284528e48a.patch
    git apply $SOURCE_ROOT/arrow.patch
  • Build and install InfluxDB

    cd $SOURCE_ROOT
    git clone https://github.com/influxdata/influxdb.git
    cd influxdb
    git checkout v2.0.3
    wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/InfluxDB/2.0.3/patch/influxdb.diff
    git apply influxdb.diff
    export NODE_OPTIONS=--max_old_space_size=4096
    make

    The binaries will be generated in $SOURCE_ROOT/influxdb/bin/linux.

  • Verify the version of InfluxDB

    ./bin/linux/influx version

    Should output

    Influx CLI v2.0.3 (git: fe04d346df) build_date: 2021-01-07T21:13:26Z

Step 4: Test (optional)

go test ./...

The following tests are known to fail due to fused multiply-add enabled on s390x. They can be ignored as this does not affect any functionality.

github.com/influxdata/influxdb/v2/influxql/query
github.com/influxdata/influxdb/v2/query/stdlib/testing

References:

https://github.com/influxdata/influxdb/blob/master/CONTRIBUTING.md#build-and-test

https://v2.docs.influxdata.com/v2.0/get-started/#start-with-influxdb-oss

Clone this wiki locally