Thursday, July 22, 2010

[Level 1] Install CouchDB in Ubuntu

How to install CouchDB in Ubuntu,
just use apt-get
# apt-get install couchdb

After start couchdb, then if you want to test manage couchdb.
You can use your brower to mange it.
# firefox http://localhost:5984 (default port)

If you want to test it by command,
you have two ways to do that.

1. Use telnet command:
# telnet locahost 5984
GET /test/test1234 HTTP/1.1
HTTP/1.0 200 OK
Server: CouchDB/0.10.0 (Erlang OTP/R13B)
Etag: "2-51d7e462ab7a57a53c0bd5a2b3becd52"
Date: Thu, 22 Jul 2010 03:04:54 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 80
Cache-Control: must-revalidate

{"_id":"test1234","_rev":"2-51d7e462ab7a57a53c0bd5a2b3becd52","name":"Stanley"}
Connection closed by foreign host.
#

2. Use curl:
a. First, download curl.
# apt-get install curl
b. Use curl to get data
# curl -X GET http://localhost:5984
/test/test1234{"_id":"test1234","_rev":"2-51d7e462ab7a57a53c0bd5a2b3becd52",
"name":"Stanley"}
#

Wish this helps.
regards,
Stanley Huang