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!
Table Of Contents
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
- Get the latest Windows binaries from the CouchDB web site (http://couchdb.apache.org/).
- On the “Welcome” screen, Accept the License agreement
- Select the installation directory
- Specify the “Start Menu” group name
- Approve the installation of CouchDB as service and it will be started automatically after installation
- Verify installation settings
- Click install for installing CouchDB
- After completion of installation, click finish.
- Open up the Futon Admin UI (if CouchDB is not autostarted after installation, you have to start it first manually)
Follow the installation wizard steps:
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).
- make sure you have a couchdb user for the daemon and the couchb group too
- get developer tools dependencies
- 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