Skip to content

Building InfluxDB

aborkar-ibm edited this page Nov 11, 2021 · 34 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 have 1.6.4
  • Ubuntu 21.04 have 1.6.7
  • SLES (15 SP2, 15 SP3) has 1.7.8

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

  • RHEL (7.8, 7.9, 8.2, 8.4)
  • SLES (12 SP5, 15 SP2, 15 SP3)
  • Ubuntu (18.04, 20.04, 21.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 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.9/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.2, 8.4)

    sudo yum install -y clang git gcc gcc-c++ wget protobuf protobuf-devel 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 which bzr 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 SP2

    sudo zypper install -y git gcc gcc-c++ wget which bzr protobuf-devel tar gzip curl patch pkg-config nodejs10 make clang
  • SLES 15 SP3

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

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

    sudo apt-get update
    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)

    cd $SOURCE_ROOT
    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 Protobuf (SLES 12 SP5 and RHEL 7.x only)

    cd $SOURCE_ROOT
    wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Protobuf/3.14.0/build_protobuf.sh
    bash build_protobuf.sh -y
    protoc --version
  • 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-$NODE_VERSION-$NODE_DISTRO.tar.xz -C /usr/local/lib/nodejs
    export PATH=/usr/local/lib/nodejs/node-$NODE_VERSION-$NODE_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
    rustup default 1.53.0
  • Install Go 1.17.1 Instructions for building Go can be found here.

    #set GOPATH as 
    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin

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.9
    wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/InfluxDB/2.0.9/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

    Output should be similar to:

    Influx CLI v2.0.9 (git: d1233b7951) build_date: 2021-10-14T15:10:29Z

Step 4: Test (optional)

cd $SOURCE_ROOT/influxdb
go test ./...

References:

Clone this wiki locally