Tuesday, December 28, 2010

Getting Started with CouchDB on Windows

In this post I will go over the details of installing and using CouchDB on a Windows machine. You can get more information about CouchDB by visiting http://couchdb.apache.org/.

Install CouchDB on Windows PC by downloading it from,
http://people.apache.org/~mhammond/dist/1.0.1/setup-couchdb-1.0.1.exe

You can get a list of all downloads from http://wiki.apache.org/couchdb/Quirks_on_Windows.

Double click setup-couchdb-1.0.1.exe and install CouchDB. You will go through the following screen shots.



If you are installing CouchDB for occasional use you may choose not to install CouchDB as a service.



Now you can click on install and install the Database. After installation you have to start the CouchDB server. For doing that go to the program menu in Windows (Start -> All Programs -> Apache CoucheDB)

You will see the CouchDB DOS prompt followed by the Erlang Emulator Version 5.8.



Now please visit http://127.0.0.1:5984/ using your Firefox browser and you will see the following message,

{"couchdb":"Welcome","version":"1.0.1"}
You can see a list of databases in the newly installed CouchDB by visiting http://127.0.0.1:5984/_all_dbs.

Now to interact with CouchDB you will need one or more of the following apps,
  1. cURL - download curl-7.21.3-ssl-sspi-zlib-static-bin-w32.zip from http://curl.haxx.se/download.html#Win32
  2. Firefox Browser - using Futon at http://127.0.0.1:5984/_utils/index.html
  3. REST Client - available in many languages including Java, Python, PHP, .NET, Ruby, JavaScript and more http://wiki.apache.org/couchdb/Related_Projects#Libraries
All data format related to CouchDB is done using JSON (more: http://guide.couchdb.org/draft/json.html). cURL is the favorite command line tool to interact with CouchDB, but while working on cURL in Windows you have to take care of the "" properly otherwise you will get error. Please see this discussion http://stackoverflow.com/questions/3347974/curl-giving-invalid-utf-8-json-error-from-couchdb-although-json-is-fine-any-id.

You can download the cURL application (curl-7.21.3-ssl-sspi-zlib-static-bin-w32.zip) from the website mentioned above (more about cURL is here http://curl.haxx.se/). After downloading the application unzip the application and you can start using cURL by going to the unzipped folder in DOS mode. You can execute the same command in the DOS mode to interact with CouchDB as shown below,
Now head over to http://guide.couchdb.org/draft/tour.html and start using CouchDB in Windows.

Optional:
I would suggest you to go ahead and install LoveSeat, a very nice interface for CouchDB. An introduction for LoveSeat can be found here.

Next you could go ahead and install CouchApp (http://couchapp.org/). The details of installing CouchApp on Windows can be found here (http://couchapp.org/page/windows-python-installers), a copy of which is given below:

Download and install the following software to your Windows box in the given sequence,
1. Python 2.7.1 (http://www.python.org/download/releases/2.7.1/)
2. Python Win32 extensions for Python 2.7 (pywin32-214.win32-py2.7.exe)
3. Python Setup Tools (setuptools-0.6c11.win32-py2.7.exe)
4. Python Restkit 2.1.4 - http://pypi.python.org/pypi/restkit/2.1.4#downloads
5. CouchApp 0.7.0

Do not forget to add C:\Python27\Scripts to the environment variables.

There are latest releases of these software out there, so if you want to you can experiment with a newer mix of these packages.

No comments:


(c) Jyotirmaya Nanda 2012