Skip to content

Building InfluxDB

linuxonz edited this page May 2, 2024 · 28 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, 23.10) have 1.6.7
  • SLES 15 SP5 has 1.10.0

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

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.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.7.6/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 tar curl patch pkgconfig make llvm-toolset-7 autoconf automake gzip libtool zlib-devel unzip 
    source /opt/rh/llvm-toolset-7/enable
    export LIBCLANG_PATH=/opt/rh/llvm-toolset-7/root/usr/lib64
    clang --version
  • RHEL (8.6, 8.8, 8.9)

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

    sudo yum install -y --allowerasing 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 autoconf automake libtool zlib-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 SP5

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

    sudo apt-get update
    sudo apt-get install -y clang git gcc g++ wget bzr protobuf-compiler libprotobuf-dev curl pkg-config make nodejs
  • Add symlink to gcc(Only for SLES and RHEL distros)

    sudo ln -sf /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
  • Install CMake (SLES 12 SP5 only)

    cd $SOURCE_ROOT
    wget https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1.tar.gz
    tar -xzf cmake-3.28.1.tar.gz
    cd cmake-3.28.1
    ./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.1.0
    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
    sudo rm -rf $SOURCE_ROOT/protobuf
    git clone -b v3.20.3 https://github.com/protocolbuffers/protobuf.git
    cd protobuf
    git submodule update --init --recursive
    ./autogen.sh
    ./configure
    make
    sudo make install
    sudo ldconfig
    protoc --version
  • Install NodeJS (RHEL 7.x only)

    NODE_VERSION=v17.5.0
    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, 9.x and SLES 15.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.21.6

    export GOPATH=$SOURCE_ROOT
    cd $GOPATH
    GO_VERSION=1.21.6
    wget -q https://storage.googleapis.com/golang/go"${GO_VERSION}".linux-s390x.tar.gz
    chmod ugo+r go"${GO_VERSION}".linux-s390x.tar.gz
    sudo rm -rf /usr/local/go /usr/bin/go
    sudo tar -C /usr/local -xzf go"${GO_VERSION}".linux-s390x.tar.gz
    sudo ln -sf /usr/local/go/bin/go /usr/bin/ 
    sudo ln -sf /usr/local/go/bin/gofmt /usr/bin/
    go version  
    export PATH=$PATH:$GOPATH/bin

Step 3: Build and Install InfluxDB

  • Install pkg-config

    cd $SOURCE_ROOT
    export GO111MODULE=on
    go install github.com/influxdata/pkg-config@v0.2.13
    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.6
    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.6 (git: 09a9607fd9) build_date: 2024-02-07T07:18:45Z
  • 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