Blog

couch

For most embedded applications a requirement is a database to store documents, settings, etc. A most powerful NoSql database is CouchDB, developed using the high performance language Erlang. I’ve selected this database for my application because it is a document based database with revision and it is capable to use fewer resources. To install it on your Fox Board, you can see the follow instructions.

  1. Step 1: install prerequisites

    As usual before you start, you must install all prerequisites:

    debarm:~$ sudo aptitude update
    debarm:~$ sudo aptitude install build-essential
    debarm:~$ sudo aptitude install libssl-dev zlib1g zlib1g-dev lsb-base
    debarm:~$ sudo aptitude install ncurses-dev libncurses-dev
    debarm:~$ sudo aptitude install unixodbc unixodbc-dev xsltproc
    debarm:~$ sudo aptitude install libmozjs-dev libmozjs2d libicu-dev libcurl-dev
    
  2. Step 2: install Erlang

    The next step is easy:

    debarm:~$ sudo aptitude install erlang
  3. Step 3: install CouchDB

    The Debian CouchDB package is older, then you install the latest revision compiling the source code.
    Download the source code:

    debarm:~$ cd /usr/local/src
    debarm:~$ wget http://it.apache.contactlab.it/couchdb/releases/1.2.0/apache-couchdb-1.2.0.tar.gz
    

    Unpacking it:

    debarm:~$ sudo tar xzvf apache-couchdb-1.2.0.tar.gz
    

    Compile it (be patient!):

    debarm:~$ cd apache-couchdb-1.2.0
    debarm:~$ sudo ./configure --prefix=/
    debarm:~$ sudo make && sudo make install
  4. Step 4: add CouchDB user and set permissions

    As usual it is appropriate to use a specific user for a new service:

    debarm:~$ sudo adduser --system --home /var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos 'CouchDB Administrator' couchdb
    

    Now you can assign the right permissions

    debarm:~$ sudo chown -R couchdb:couchdb /etc/couchdb
    debarm:~$ sudo chown -R couchdb:couchdb /var/lib/couchdb
    debarm:~$ sudo chown -R couchdb:couchdb /var/log/couchdb
    debarm:~$ sudo chown -R couchdb:couchdb /var/run/couchdb
    debarm:~$ sudo chown -R couchdb:couchdb /etc/init.d/couchdb
    debarm:~$ sudo chmod 0770 /etc/couchdb
    debarm:~$ sudo chmod 0770 /var/lib/couchdb
    debarm:~$ sudo chmod 0770 /var/log/couchdb
    debarm:~$ sudo chmod 0770 /var/run/couchdb
    
  5. Step 5: start the service

    To start the couchdb when you start your Fox Board, you simply type:

    debarm:~$ sudo update-rc.d couchdb defaults
    

    whereas to stop it:

    debarm:~$ sudo /etc/init.d/couchdb stop
    

    and to start it again:

    debarm:~$ sudo /etc/init.d/couchdb start
    
  6. Step 6: test CouchDB

    If your service is started and you type:

    debarm:~$ curl http://localhost:5984
    

    you can see:

    {"couchdb":"Welcome","version":"1.2.0"}
    

    Ok: your CouchDB is ready! Read CouchDB official documentation to work with it.

Reference: http://www.freshblurbs.com/install-couchdb-debian-squeeze-source

UPDATE. If you have updated your Debian Squeeze to Wheeze following my guide you can install CouchDB 1.2.0 simply typing:

debarm:~# aptitude update
debarm:~# aptitude install couchdb

 ,

About Marcello Gesmundo

I'm the founder of Yoovant company. I'm an engineer and an artist: what could be better than combine the technologies with the arts?

5 Comment(s)
  1. Marc Nicholas September 23, 2013 at 15:48

    Hi Marcello,
    Your blog is a wonderful resource for those using Acme products — thanks for taking the time to write it!

    How did you find performance and memory usage of Couch on the G20? We’d love to use it on our Aria G25-based product.

    Thx.
    -marc

    • Marcello Gesmundo September 23, 2013 at 17:34

      Hi Marc,
      to see memory usage of CouchDB simply use htop from your console: it is very little!
      Thank you.
      Marcello

  2. VitoA February 5, 2014 at 01:03

    Hi, great tutorial
    Any future plan for a MongoDB installation on AriaG25 or fox board?

    Regards,
    Vitor

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>