Differences between revisions 11 and 12
Revision 11 as of 2014-04-21 18:07:55
Size: 6160
Editor: RobertNewson
Comment: minor fixes (sudo, -d dir)
Revision 12 as of 2014-04-21 18:10:42
Size: 6225
Editor: RobertNewson
Comment: add symlink for service hook
Deletions are marked like this. Additions are marked like this.
Line 81: Line 81:
/etc/init.d/couchdb start sudo /etc/init.d/couchdb start
Line 83: Line 83:
update-rc.d couchdb defaults sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d/
sudo update-rc.d couchdb defaults

The official documentation has moved to http://docs.couchdb.org — The transition is not 100% complete, but http://docs.couchdb.org should be seen as having the latest info. In some cases, the wiki still has some more or older info on certain topics inside CouchDB.

You need to be added to the ContributorsGroup to edit the wiki. But don't worry! Just email any Mailing List or grab us on IRC and let us know your user name.

Building from Source on Debian Wheezy

This content has moved to the new wiki

Pre-packaged

CouchDB is available in Debian repositories, but it typically lags CouchDB releases significantly, and in addition, Debian Squeeze still uses a beta release of Erlang/OTP.

aptitude show couchdb
  Package: couchdb
  State: not installed
  Version: 0.11.0-2.3
  Priority: optional
  Section: misc
  Maintainer: Erlang Packaging Team <pkg-erlang-devel@lists.alioth.debian.org>
  Uncompressed Size: 2,167 k
  Depends: libc6 (>= 2.2.5), libcurl3 (>= 7.16.2-1), libicu44 (>= 4.4.1-1), libmozjs2d (>= 1.9.1), erlang-base (>= 1:14.a-dfsg) | erlang-base-hipe (>= 1:14.a-dfsg), erlang-crypto (>= 1:14.a-dfsg), erlang-inets
         (>= 1:14.a-dfsg), erlang-ssl (>= 1:14.a-dfsg), erlang-tools (>= 1:14.a-dfsg), erlang-xmerl (>= 1:14.a-dfsg), erlang-abi-13.a, adduser, libjs-jquery, lsb-base, procps, mawk
  Description: RESTful document oriented database
   Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.

   CouchDB is written in Erlang, but can be easily accessed from any environment that provides means to make HTTP requests. There are a multitude of third-party client libraries that make this even easier for a variety of programming languages and environments.
  Homepage: http://couchdb.apache.org/

# please don't try this at home
sudo aptitude -y install couchdb

Oy vey! Let's not do that.

Instructions to build, Erlang/OTP, SpiderMonkey, and CouchDB from source follow.

Installing From Source

We'll need some pre-requisites:

# build tools
sudo aptitude install -y build-essential libtool autoconf automake autoconf-archive pkg-config
# dependencies
sudo aptitude install -y libssl0.9.8 libssl-dev zlib1g zlib1g-dev libcurl4-openssl-dev lsb-base  ncurses-dev libncurses-dev libmozjs-dev libmozjs2d libicu-dev xsltproc
# optional for building documentation
sudo aptitude install -y help2man python-sphinx texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texinfo

Installing Erlang/OTP

cd /tmp/
wget http://www.erlang.org/download/otp_src_R14B04.tar.gz
tar xzf otp_src_R14B04.tar.gz
cd otp_src_R14B04
echo "skipping gs" > lib/gs/SKIP
echo "skipping jinterface" > lib/jinterface/SKIP
echo "skipping odbc" > lib/odbc/SKIP
echo "skipping wx" > lib/wx/SKIP
./configure --prefix=/usr/local
make && sudo make install

Check that worked by starting the crypto OTP application: erl -eval "case application:load(crypto) of ok -> io:format(\"crypto is working~n\", []), ok; _ -> exit(no_crypto) end." -noshell -s init stop.

Building CouchDB

This assumes you've decided to use the debian-provded mozjs. A later update will explain how best to avoid that.

./configure --prefix=/usr/local --with-js-lib=/usr/lib --with-js-include=/usr/include/mozjs --enable-init
make && make check && sudo make install
# Add couchdb user account
useradd -d /usr/local/var/lib/couchdb couchdb
# If you want, add your user account to /etc/group #couchdb
chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb
chmod -R g+rw /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb

# start couchdb
sudo /etc/init.d/couchdb start
# Start couchdb on system start
sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d/
sudo update-rc.d couchdb defaults

# Verify couchdb is running
curl http://127.0.0.1:5984/
# {"couchdb":"Welcome","version":"1.2.0"}

Python Bits

These are likely needed to build the documentation.

aptitude install -y python-virtualenv python-pip
cd $MY_COUCH_SOURCE_REPO
virtualenv env
source env/bin/activate
which python pip
pip install sphinx docutils pygments

Minimal packages

If you need custom erlang versions, use kerl, otherwise apt-get update && apt-get install -y erlang and skip this section.

{{ # build tools sudo aptitude install -y build-essential libtool autoconf automake autoconf-archive pkg-config sudo aptitude install -y build-essential libtool autoconf automake autoconf-archive pkg-config git # dependencies for libmozjs etc sudo apt-get install -y libmozjs185-cloudant libmozjs185-cloudant-dev libnspr4 libnspr4-0d libnspr4-dev libcurl4-openssl-dev curl

# dependencies for building erlang releases if you want that sudo apt-get install -y libssl-dev zlib1g zlib1g-dev libcurl4-openssl-dev lsb-base ncurses-dev libncurses-dev libicu-dev xsltproc # optional for building documentation sudo aptitude install -y help2man python-sphinx texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texinfo }}}

Run-time minimal packages for CouchDB are:

  • libcurl-openssl libicu libmozjs185
  • erlang: erlang-asn1 erlang-base-hipe erlang-crypto erlang-dev erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-xmerl

Built-time additional dependencies are:

  • libicu-dev libmozjs185-dev libcurl4-openssl-dev pkg-config
  • build-essential erlang-base-hipe erlang-dev erlang-manpages erlang-eunit erlang-nox

Using Kerl to build a custom Erlang version

curl https://raw.github.com/spawngrid/kerl/master/kerl > ~/bin/kerl \
    && chmod a+x ~/bin/kerl
export PATH=$PATH:~/bin
kerl update releases
kerl build R14B04 r14b04
kerl install r14b04 ~/erlbrew/r14b04
kerl build R15B03-1 r15b03
kerl install r15b03 ~/erlbrew/r15b03
kerl build R16B02 r16b02
kerl install r16b02 ~/erlbrew/r16b
. ~/erlbrew/r14b04/activate

After that, cloning or downloading couchdb tarball and configure/build should Just Work.

Installing_on_Debian (last edited 2014-04-21 18:10:42 by RobertNewson)