Web Dev

CouchDb Installation – How to Install CouchDB

This article is part of our Academy Course titled CouchDB – Database for the Web.

This is a hands-on course on CouchDB. You will learn how to install and configure CouchDB and how to perform common operations with it. Additionally, you will build an example application from scratch and then finish the course with more advanced topics like scaling, replication and load balancing. Check it out here!

1. Introduction

Apache CouchDB is an open source NoSQL database that uses JSON to store data, JavaScript as its query language, also uses MapReduce, and HTTP for an API. In CouchDB, each database is a collection of documents. Each document maintains its own data and self-contained schema. An application may access multiple databases on different servers. Document metadata contains the necessary revision information to make the merging possible in case the databases were disconnected.

In CouchDB, every document has a unique id and there is no required document schema. CouchDB can handle a high volume of concurrent readers and writers without conflict. Stored data is structured using views. Each view is constructed by a JavaScript function that acts as the Map. The function takes a document and transforms it into a single value which it returns. CouchDB can index views and keep those indexes updated as documents are added, removed, or updated.

CouchDB is designed with replication and off-line operation in mind. Here, multiple replicas can have their copies of the same data, modify it, and then sync those changes at a later time. All operations have a unique URI that gets exposed via HTTP. REST APIs use the HTTP methods POST, GET, PUT and DELETE for the four basic CRUD (Create, Read, Update, Delete) operations on all resources.

CouchDB is able to replicate to devices that can go offline and handle data sync when the devices get back online.

2. Couch DB Installation on Mac OS

To install CouchDB on a Mac machine, follow the steps given below:

  • Step 1: Download the Apache Couch DB first. Click on the following link, http://couchdb.apache.org/
  • Step 2: Click on the download button to get the latest version of CouchDB.
  • Step 3: Download the version according to MAC OS platform.
  • Step 4: It will download a .zip file.
  • Step 5: Extract the .zip file.
  • Step 6: Copy the CouchDb file & paste it in the application folder of your Mac OS Machine.
  • Step 7: Run Apache CouchDB application.
  • Step 8: To check the installation, Go to the url, http://localhost:5984/_utils/ to view the CouchDB Admin console.

3. Couch DB Installation on Windows

  1. Get the latest Windows binaries from the CouchDB web site (http://couchdb.apache.org/).
  2. Follow the installation wizard steps:

    Figure 1
    Figure 1
  3. On the “Welcome” screen, Accept the License agreement

    Figure 2
    Figure 2
  4. Select the installation directory

    Figure 3
    Figure 3
  5. Specify the “Start Menu” group name

    Figure 4
    Figure 4
  6. Approve the installation of CouchDB as service and it will be started automatically after installation

    Figure 5
    Figure 5
  7. Verify installation settings

    Figure 6
    Figure 6
  8. Click install for installing CouchDB

    Figure 7
    Figure 7
  9. After completion of installation, click finish.

    Figure 8
    Figure 8
  10. Open up the Futon Admin UI (if CouchDB is not autostarted after installation, you have to start it first manually)

    Figure 9
    Figure 9

4. Couch DB Installation on Ubuntu

Depending on rhe Ubuntu release, CouchDB availability varies. Newer versions of Ubuntu have a recent CouchDB included in their respective software repositories. We can install CouchDB with the Ubuntu Software Center, or from the command line with the apt-get or aptitude utilities. However, to get the newest version of CouchDB we may have to install from source, or other package repositories that have newer pre-built CouchDB packages.

4.1 Installing using an existing package

Open a Terminal and type:

sudo apt-get install couchdb -y

Troubleshooting: If the aptitude/apt-get installation gives an error message then CouchDB might not have access to its pid file in Ubuntu Machine.

In order to resolve this, type in a Terminal:

sudo chown -R couchdb /var/run/couchdb

Then rerun the setup script:

sudo dpkg --configure couchdb

4.2 Installing from Source on
Precise, Quantal, Raring, and Saucy

Download the CouchDB sources from an apache mirror (http://www.apache.org/dyn/closer.cgi?path=couchdb/source/1.4.0/apache-couchdb-1.4.0.tar.gz).

  1. make sure you have a couchdb user for the daemon and the couchb group too
  2. get developer tools dependencies
  3. sudo apt-get install -y g++
  4. sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets

Piyas De

Piyas is Sun Microsystems certified Enterprise Architect with 10+ years of professional IT experience in various areas such as Architecture Definition, Define Enterprise Application, Client-server/e-business solutions.Currently he is engaged in providing solutions for digital asset management in media companies.He is also founder and main author of "Technical Blogs (Blog about small technical Know hows)"
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button