Skip to content

Building InfluxDB

aborkar-ibm edited this page Jun 15, 2023 · 36 revisions

Building InfluxDB

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

  • Ubuntu 20.04 has 1.6.4
  • Ubuntu (22.04, 22.10, 23.04) have 1.6.7
  • SLES 15 SP4 has 1.8.10

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

  • RHEL (7.8, 7.9, 8.6, 8.7, 8.8 , 9.0, 9.1, 9.2)
  • SLES (12 SP5, 15 SP4)
  • Ubuntu (20.04, 22.04, 22.10, 23.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.7.1/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
    source /opt/rh/llvm-toolset-7/enable
    export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/usr/lib64
    clang --version
  • RHEL (8.6, 8.7, 8,8)

    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
  • RHEL (9.0, 9.1, 9.2)

    sudo yum install -y clang git gcc gcc-c++ wget protobuf protobuf-devel tar curl patch pkg-config make nodejs python3
    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 nodejs14 make bzip2 cmake libarchive13 libopenssl-devel unzip zip libnghttp2-devel
    
    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 SP4

    sudo zypper install -y git gcc gcc-c++ wget which bzr protobuf-devel tar gzip curl patch pkg-config nodejs16 make clang7 
  • Ubuntu (20.04, 22.04, 22.10, 23.04)

    sudo apt-get update
    sudo apt-get install -y 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 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 and 9.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.20

    cd $SOURCE_ROOT
    wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Go/1.18.4/build_go.sh
    bash build_go.sh -y -v 1.20

Step 3: Build and Install InfluxDB

  • Install pkg-config

    cd $SOURCE_ROOT
    export GO111MODULE=on
    go install github.com/influxdata/[email protected]
    which -a pkg-config
  • Build and install InfluxDB

    cd $SOURCE_ROOT
    git clone https://github.com/influxdata/influxdb.git
    cd influxdb
    git checkout v2.7.1
    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/$(uname -s | tr '[:upper:]' '[:lower:]')/influxd version

    Output should be similar to:

    InfluxDB v2.7.1 (git: 85f725f8b9) build_date: 2023-04-11T19:21:03Z
  • Start the InfluxDB service

    sudo cp $SOURCE_ROOT/influxdb/bin/linux/influxd /usr/bin/influxd
    influxd

Note:

  • After starting InfluxDB service, you can view the UI at http://<HOST_IP>:8086/.

Step 4: Test (optional)

cd $SOURCE_ROOT/influxdb
make test

Notes:

Below mentioned test failures are observed in github.com/influxdata/influxdb/v2/cmd/influxd/recovery module as it uses hard coded x86 specific test data.

  • github.com/influxdata/influxdb/v2/cmd/influxd/recovery/auth
  • github.com/influxdata/influxdb/v2/cmd/influxd/recovery/organization
  • github.com/influxdata/influxdb/v2/cmd/influxd/recovery/user

References:

Clone this wiki locally