Ralf Quebbemann

About Ralf Quebbemann

Ralf graduated in computer science at the University of Oldenburg, Germany. He is developing software for over 20 years now and likes to program in Java. He wrote and contributed different Apache Maven plugins and implemented initially Maven support for IntelliJ IDEA.

How to install Couch DB 1.5 on Ubuntu

A recent task I had to do on my home Ubuntu Linux box running 12.04. LTS was to install CouchDB. I needed it because I wanted to use ACRA as remote error reporting tool for Android Apps. Acra is completely open source ( hosted on GitHub) and an incredible cool tool started by Kevin Gaudin.

I used to try it out using Iris Couch but it turns out for me that Iris Couch using the free of charge account is painful slow. Thus I decided to host my own CouchDB at home.

The Ubuntu repositories doesn’t host an up to date version of Couch DB. I tried it using apt-get and got CouchDB version 1.0.1. This was not a viable choice, because I wanted to use the replicate function of CouchDB which only is available on version higher than 1.2.

I found a pretty good step by step guide in the Apache CouchDB wiki.

To sum it up:

I installed it by compiling it from source using the following steps.

  1. Download CouchDB 1.5 sources
  2. Create a user and a group with name ‘couchdb’. This is very important. Don’t compile and install it with user ‘root’. If you do it with root, CouchDB will not start nor write any error messages to any log file, because CouchDB will start under user ‘couchdb’ but all installed files and folders don’t allow read or write access for any other user than ‘root’. If you have compiled and installed it with user ‘root’ you have to adjust the permissions and owner rights of various files and folders by yourself. I have to admit that I did it with user ‘root’ the first time and it took me two hours to search for the causes and correct everything. So be warned!
  3. Install at least the following packages.
    sudo apt-get install -y g++  
     sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets  
     sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool
  4. Extract and compile CouchDB using default installation directory /usr/local. You can change it by using a different –prefix when calling configure. Check manual.
    cd /tmp && tar xvzf apache-couchdb-1.5.0.tar.gz  
     cd apache-couchdb-*  
     ./configure && make
  5. Install CouchDB. CouchDB installs into /usr/local
    sudo make install
  6. Sometimes it’s necessary to remove old stuff from ubuntu packages. This was not necessary in my case. But you can do the following:
    sudo rm /etc/logrotate.d/couchdb /etc/init.d/couchdb
  7. Install init scripts and logrotate
    sudo ln -s /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d/couchdb  
     sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d  
     sudo update-rc.d couchdb defaults
  8. Verify that CouchDB is running
    curl http://127.0.0.1:5984/

    It should give you an output like this:

    {"couchdb":"Welcome","uuid":"5a23983ac768251e1c8d413bb52e67b5","version":"1.5.0","vendor":{"version":"1.5.0","name":"The Apache Software Foundation"}}
  9. With this setup, CouchDB only listens on localhost (127.0.0.1). If you want CouchDB to listen on all interfaces and access it externally you have to configure it in /usr/local/etc/couchdb/local.ini
    Just look for the [httpd] section and uncomment the line starting with ‘bind_address’ and replace 127.0.0.1 with 0.0.0.0

    [httpd]  
     ;port = 5984  
     bind_address = 0.0.0.0
  10. Now restart CouchDB and you are done.
    /etc/init.d/couchdb restart

You are also able to install a CouchDB version built by source alongside the default Ubuntu package. Check out the step by step guide mentioned above to look how this is being achieved.
 

Related Whitepaper:

Java Application Development on Linux

Linux is the fastest-growing Java development platform because it saves money and time by serving as a platform for both development and deployment. But developers face significant platform-specific challenges when managing and deploying Java applications in a controlled production environment.

This is the hands-on guide to the full Java application development lifecycle on Linux. It demonstrates the platform, tools, and application development by showing realistic, easy-to-follow examples. After a simple command-line application introduces basic tools, this program leads readers through business-logic object analysis, database design, Java servlet UIs, Java Server Pages (JSP) UIs, Swing GUIs, and Standard Widget Toolkit (SWT) GUIs. Scaling up to the enterprise level provides the opportunity to use both the JBoss Application Server and the Apache Geronimo Application Servers, and Enterprise JavaBeans (EJB).

Get it Now!  

One Response to "How to install Couch DB 1.5 on Ubuntu"

  1. Did you give Cloudant.com a try for hosting your ACRA content? It’s got a Apache CouchDB compatible API as it’s built from the same code–and soon they’ll be the same again as Cloudant has contributed the BigCouch code to Apache CouchDB and is working on finishing up the merge.

    Would love to hear your experiences with it if you give it a try. Thanks!

Leave a Reply


2 × = sixteen



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books