2014-11-27

How to install Couchbase on ArchLinux

Couchbase is NoSQL database with the best performance AFAIK. To install Couchbase, we need git and repo tool, that could be installed using this command:

sudo pacman -S git libtool gcc libevent make gperftools sqlite erlangautomake autoconf make curl dmidecode
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod +x ~/bin/repo

Change first line from python to python2.7, then initialize and start fetch the Couchbase repository:

mkdir couchbase
cd couchbase
repo init -u git://github.com/couchbase/manifest.git -m released/3.0.1.xml
repo snyc

To prevent failure when building python-based programs, symlink your python to the older one:

sudo ln -sf python2.7 /usr/bin/python

Install older version of v8 (3.21.17 or less), using this command:

yaourt -S v8-3.15
V8PKG=v8-3.19.18.4-1-x86_64.pkg.tar.xz
wget http://seblu.net/a/arm/packages/v/v8/$V8PKG
sudo pacman -U $V8PKG

Then compile the Couchbase:

make

Note if this step failed clean the couchbase first using make clean, then compile the v8 on the v8 folder in the couchbase directory. If you're using latest version of GCC, remove all werror string from build/standalone.gypi and build/toolchain.gpyi file:

make dependencies
export PYTHON=python2
  find build/ test/ tools/ src/ -type f \
    -exec sed -e 's_^#!/usr/bin/env python$_&2_' \
              -e 's_^\(#!/usr/bin/python2\).[45]$_\1_' \
              -e 's_^#!/usr/bin/python$_&2_' \
              -e "s_'python'_'python2'_" -i {} \;
  sed -i 's/python /python2 /' Makefile
sed -i 's/-Werror//' build/standalone.gypi build/common.gypi
make x64.release library=shared console=readline

Alternatively use this modified PKGBUILD file:

wget http://goo.gl/miEmFt -O PKGBUILD
makepkg
sudo pacman -U v8-3.21-3.21.17-1-x86_64.pkg.tar.xz

Don't forget to increase the default number of files:

echo '
*               soft    nofile          65536
*               hard    nofile          65536
' | sudo tee -a /etc/security/limits.conf

And last, start the server:

./install/bin/couchbase-server

Then just visit the web interface to setup the cluster http://localhost:8091/

That's it, that's how you install Couchbase on ArchLinux from source.