Skip to content

Building CouchDB

aborkar-ibm edited this page Mar 17, 2020 · 45 revisions

Building CouchDB

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

  • Ubuntu 16.04 have 1.6.0

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

  • RHEL (7.5, 7.6, 7.7)
  • Ubuntu (16.04, 18.04)

General Note:

  • 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.

Step 1 : Building CouchDB

1.1) Build using script

If you want to build CouchDB using manual steps, go to STEP 1.2.

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

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/CouchDB/3.0.0/build_couchdb.sh

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

If the build completes successfully, go to STEP 2.2. In case of error, check logs for more details or go to STEP 1.2 to follow manual build steps.

1.2) Install dependencies

export SOURCE_ROOT=/<source_root>
  • RHEL (7.5, 7.6, 7.7)

     sudo yum install -y libicu-devel libcurl-devel wget tar m4 pkgconfig make libtool which gcc-c++ gcc openssl openssl-devel patch js-devel java-1.8.0-openjdk-devel perl-devel gettext-devel unixODBC-devel 
    • Instructions for building Python 3.x can be found here
  • Ubuntu 16.04

    sudo apt-get update
    sudo apt-get install -y build-essential pkg-config gcc curl git patch wget tar make autoconf automake autoconf g++ libmozjs185-dev libicu-dev libcurl4-openssl-dev locales libncurses-dev libssl-dev unixodbc-dev libwxgtk3.0-dev openjdk-8-jdk
    • Instructions for building Python 3.x can be found here
  • Ubuntu 18.04

    sudo apt-get update
    sudo apt-get install -y build-essential pkg-config ncurses-base g++-5 gcc-5 python python3 python3-pip python3-venv curl git patch wget tar make zip autoconf2.13 automake libicu-dev libcurl4-openssl-dev libncurses5-dev locales libncurses-dev libssl-dev unixodbc-dev libwxgtk3.0-dev openjdk-8-jdk
    
    sudo rm -rf /usr/bin/gcc /usr/bin/g++ /usr/bin/cc
    sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
    sudo ln -s /usr/bin/g++-5 /usr/bin/g++
    sudo ln -s /usr/bin/gcc /usr/bin/cc

1.3) Install git 2.16.0 (Only for RHEL)

cd $SOURCE_ROOT
wget https://github.com/git/git/archive/v2.16.0.tar.gz
tar -zxf v2.16.0.tar.gz
cd git-2.16.0
make configure
./configure --prefix=/usr
make
sudo make install

1.4) Install Erlang 22.2

cd $SOURCE_ROOT
wget http://www.erlang.org/download/otp_src_22.2.tar.gz
tar zxf otp_src_22.2.tar.gz
cd otp_src_22.2
export ERL_TOP=$SOURCE_ROOT/otp_src_22.2
./configure --prefix=/usr
make
sudo make install

1.5) Install elixir

cd $SOURCE_ROOT
git clone https://github.com/elixir-lang/elixir.git
cd elixir
git checkout v1.10.2
export LANG=en_US.UTF-8 
sudo locale-gen en_US.UTF-8  # for Ubuntu
make
sudo make install

1.6) Install SpiderMonkey 1.8.5 (Only for Ubuntu 18.04)

  • Obtain the SpiderMonkey and extract the source

    cd $SOURCE_ROOT
    wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
    tar zxf js185-1.0.0.tar.gz
    export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/CouchDB/3.0.0/patch"
    curl -o jsval.h.diff $PATCH_URL/jsval.h.diff 
    patch "$SOURCE_ROOT/js-1.8.5/js/src/jsval.h" jsval.h.diff 
    curl -o jsvalue.h.diff $PATCH_URL/jsvalue.h.diff 
    patch "$SOURCE_ROOT/js-1.8.5/js/src/jsvalue.h" jsvalue.h.diff
    curl -o Makefile.in.diff $PATCH_URL/Makefile.in.diff 
    patch "$SOURCE_ROOT/js-1.8.5/js/src/Makefile.in" Makefile.in.diff  
  • Prepare the source code

    cd $SOURCE_ROOT/js-1.8.5/js/src  
    autoconf2.13                  
  • Configure, build & install SpiderMonkey

    mkdir $SOURCE_ROOT/js-1.8.5/js/src/build_OPT.OBJ
    cd $SOURCE_ROOT/js-1.8.5/js/src/build_OPT.OBJ
    ../configure --prefix=/usr
    make
    sudo make install

1.7) Download the CouchDB source code

cd $SOURCE_ROOT
git clone https://github.com/apache/couchdb.git
cd couchdb
git checkout 3.0.0

1.8) Configure and build CouchDB

./configure -c --disable-docs --disable-fauxton
export LD_LIBRARY_PATH=/usr/lib
make

Step 2: Testing (Optional)

2.1) Run all test cases

make check

2.2) Start the CouchDB server

sudo $SOURCE_ROOT/couchdb/dev/run &

Note: In case of an error /usr/bin/env: python3: No such file or directory on RHEL run command as sudo env PATH=$PATH $SOURCE_ROOT/couchdb/dev/run &

2.3) Verify the output of CouchDB server by using curl http://127.0.0.1:15984/ command. The output should be similar to the following:

{"couchdb":"Welcome","version":"3.0.0","git_sha":"03a77db","uuid":"fake_uuid_for_dev","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

References:

CouchDB 3.0.0 Documentation

Clone this wiki locally