Tuesday, March 22, 2011

install couchdb 1.2.0 on AWS (AMI: ami-8e08a38f) successfuly

0. pre-isntall os dependencies.
on CentOS.
$ sudo yum install gcc glibc-devel make ncurses-devel openssl-devel yum install libicu-devel curl-devel git nmap

or on ubuntu 10.04
$ sudo apt-get install libtool libicu-dev libssl-dev libssl0.9.8 (for building couchdb, ssl is for erlang).

1. make sure your have curl

build it from source:

$ wget http://curl.haxx.se/download/curl-7.21.4.tar.gz
$ tar -xvzf curl-7.21.4.tar.gz
$ cd curl-7.21.4
$ ./configure --prefix=/usr/local
$ make
$ make test
$ sudo make install

result:
curl --version
curl 7.21.4 (i686-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

2. check your linux version

uname -a
Linux ip-10-146-47-148 2.6.34.7-56.40.amzn1.i686 #1 SMP Fri Oct 22 18:48:33 UTC 2010 i686 i686 i386 GNU/Linux

3. Install SpiderMonkey (Mozilla javascript is required for build couchDB)

$ wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz
$ tar xvzf js-1.8.0-rc1.tar.gz
$ cd js/src
$ make BUILD_OPT=1 -f Makefile.ref
$ sudo make BUILD_OPT=1 JS_DIST=/usr/local -f Makefile.ref export

4. Install Erlang (couchDB is written by Erlang)

Remark: pre-install ncurses-devel.i386 first on CentOS (yum install ncurses-devel.i386)
or (sudo apt-get install libncurses5-dev) on ubuntu 10.04.

$ wget http://erlang.org/download/otp_src_R14B02.tar.gz
$ tar xvzf otp_src_R14B02.tar.gz
$ cd otp_src_R14B02
$ ./configure && make && sudo make install

result:
erl -version
Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.8.3

5. build couchdb

$ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
$ cd couchdb
$ ./bootstrap
$ ./configure
$ make && sudo make install


6. configure couchdb

Edit the CouchDB configuration file (if necessary)

# vi /usr/local/etc/couchdb/local.ini

Create couchdb user and change file ownership

$ sudo adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb
$ sudo chown -R couchdb: /usr/local/var/lib/couchdb /usr/local/var/log/couchdb

Set CouchDB service to run on startup:

# ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb (on ubunutu, ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb)

# chkconfig --add couchdb
# chkconfig --level 345 couchdb on

Start CouchDB and verify it running:

# sudo service couchdb start
# sudo service couchdb status
# curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"1.2.0a1084126"}

REMARKS:
1. first problem you may also encounter for sing in a new account or fix party admin. see also,
http://couchdbtw.blogspot.com/2011/03/first-problem-i-had-encountered-is-i.html

2 comments:

  1. here is the way to upgrade your couchDB:

    goto step 5 and type

    $ svn update

    then repeat step 5. except the first line of commands. (you don't have to check out code again, just update it.

    If you got make error on couch_js/utf8.h file, just add a newline at the end of this file. (it works)

    ReplyDelete
  2. $ curl localhost:5894
    {"couchdb":"Welcome","version":"1.3.0a-1180567"}

    ReplyDelete