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
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.
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.
- 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:
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.
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
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