Building Couchbase from Source on Linux

Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Couchbase Source

The latest source is available via the github repositories or you can get a source tarball of the latest Community Release from the download page for the latest release.

Building from source is easiest from the distribution tarball and is recommended for those looking to build on other OSs for which there are no binary releases. Building straight from the repositories and upstream source code projects is recommended if you are a developer who is enhancing Couchbase.


Every Linux and other UNIX distributions have their own organization and default software packages that are included by default.

Ubuntu Ubuntu 11.04

The following packages are required, and can be installed using the command 'apt-get install <packagelist>'. The instructions below are tested on Ubuntu 10.04.

sudo apt-get install gcc g++ automake autoconf make curl dmidecode
Cent OS 5.6.

The following packages are required , and can be installed using the command "yum install <packagelist>' The instructions below are tested on Centos 5.6 64-bit.

CentOS release 5.6 (Final)
#uname -a
Linux domU-12-31-39-0C-2E-BC 2.6.18-238.19.1.el5.centos.plusxen #1 SMP Mon Jul 18 11:02:46 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
RightImage_CentOS_5.6_x64_v5.7.14 (ami-49e32320)

The list of packages installed on the machine mentioned above is listed here.

package installation instructions:

yum -y install gcc gcc-c++ automake autoconf make curl dmidecode openssl-devel ncurses ncurses-devel
download and install curl (curl-7.21.4)
tar -xvf curl-7.21.4.tar.gz
cd curl-7.21.4
./configure && make && make install
download and install libevent (libevent-2.0.11)
wget --no-check-certificate
tar -xvf libevent-2.0.19-stable.tar.gz
cd libevent-2.0.19-stable
./configure  && make && make install
download and install erlang R14B03

Erlang R14B03 -- please visit for more information.

tar -xvf otp_src_R14B03.tar.gz
cd otp_src_R14B03
./configure --disable-option-checking 'CFLAGS=-O2 -g ' 'CXXFLAGS=-O2 -g ' --cache-file=/dev/null --srcdir=.
make install

Many Couchbase developers use MacOS X as their primary development O/S. See the [OSX specific page] for details.


Python is used by the couchbase command-line tools (at runtime).

Inside the source package

You will first need to unarchive the source distribution file:

tar -xvzf couchbase{$ver}_src.tar.gz

Once un-archived, the components that are included with the Couchbase source distribution include:

  • memcached - core data networking server
  • bucket_engine - multitenancy plug-in to memcached
  • ep-engine - persistence plug-in to memcached
  • libvbucket - library for elastic key hashing
  • libconflate - library to allow moxi to support dynamic configuration
  • moxi - proxy for memcached and couchbase
  • membase-cli - command-line utiity
  • ns_server - cluster management, monitoring and orchestration, with web UI console and REST administration API
  • sigar & portsigar - system monitoring library
  • couchdb - Apache CouchDB
  • memcachetest - a simple test utility for generating a large number of gets and sets

Building Membase

Assuming you are building from the consolidated source tarball, you will simply extract the tarball, cd into the directory and execute "make". If you have dependent components such as libcurl in different locations, you may need to edit the Makefile slightly to use the correct paths at buildtime. See the troubleshooting section below. As couchdb isn't required for the 1.8 or earlier builds, when running make disable it (removes the spidermonkey dependency as well.)

  • make DISABLE_COUCH=1

If instead you are building from individual components out of the source repository, you will need to generate the configure script and Makefile using autoconf and automake. In ns_server you will find a sample Makefile, "Makefile.all" which can assist with this.

Troubleshooting The Build

When building couchbase, the most frequent issues encountered involve not having the correct dependencies or not having them in the right path at the right time.

Things to check:

  • Is "erl" in your $PATH ?
Other Troubleshooting
  • Setting Special Locations
    If you have libcurl in a different location, you may need to edit the source tarball Makefile to add the CFLAGS and LDFLAGS. For instance:
  • File Descriptor Settings
    Couchbase starts a memcached process which allows up to 10,000 open connections. Therefore, it needs to be able to set it's number of open file descriptors to that amount. You will need to adjust the allowable number of file descriptors if you see this in the log:

Port server memcached on node 'ns_1@' exited with status 71. Restarting. Messages: failed to set rlimit for open files. Try running as root or requesting smaller maxconns value.* Makefile Changes not Picked Up

If after a failed build you make a change to the Makefile but find it does not take effect, you may need to clean up the previous configuration used with that component. Do this by going to the component's directory and running "make dist clean"

Running Couchbase

To start the couchbase server...


On releases earlier than 1.8, you may have to use...


Next, you can telnet to port 11211 and issue memcached commands...

$ telnet localhost 11211
    set some_greeting 0 0 5
    get some_greeting
    VALUE some_greeting 0 5

To see the web console UI go to http://(host):8091/

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.