Install ApacheCouchDB in Ubuntu

Source: Internet
Author: User
Tags couchdb
CouchDB is now very popular and has received support from IBM and has become a sub-project under Apache. CouchDB is developed using Erlang and the installation platform uses Ubuntu, however, you can also download the CouchDB Installation File on other Linux platforms. Go to the CouchDB official website to download the CouchDB installation file. The version is 0.9.1http: // couchdb.apache.org/downloads.html. couchdbis a new project.

CouchDB is now very popular and has received support from IBM and has become a sub-project under Apache. CouchDB is developed using Erlang and the installation platform uses Ubuntu, but it should also be available on other Linux platforms

Download the CouchDB installation file first. Go to the CouchDB official website from the source. The version is 0.9.1.

Http://couchdb.apache.org/downloads.html

Because CouchDB is a new project and is not included in the Debian repository, it cannot be found through apt. Therefore, it is compiled and installed in the form of source code package, which is the dependency package of CouchDB.

Sudo apt-get build-dep couchdb

Sudo apt-get install libbench js-dev libicu-dev libcurl4-gnutls-dev libtool

In README of CouchDB, it should be noted that libicu38 is to be installed, but the shitou reported an error saying that Mi was found. Later, apt-file search libicu found that it was not libicu38, instead, there is a libicu36 package. install it.

2. Extract

Tar-zxvf apache-couchdb-0.9.1.tar.gz

3. Start Installation

Cd apache-couchdb-0.9.1

./Configure

Make

Sudo make install

OK. installation is complete.

We recommend that you do not use root to run CouchDB for security reasons.

4. Start couchdb

Sudo couchdb

5. Access: http: // 127.0.0.1: 5984/_ utils/

-B runs the CouchDB service for the background

-D to disable the couchdb Service

The default CouchDB configuration file is in/usr/local/couchdb/etc/couchdb/couch. ini, and the port is 5984.

Now let's test it. shitou uses ruby, and the connected database uses code from the official website. couchdb_ruby.rb:

Require 'net/http'

Module Couch

Class Server
Def initialize (host, port, options = nil)
@ Host = host;
@ Port = port;
@ Options = options;
End

Def delete (uri)
Request (Net: HTTP: Delete. new (uri ))
End

Def get (uri)
Request (Net: HTTP: Get. new (uri ))
End

Def put (uri, json)
Req = Net: HTTP: Put. new (uri)
Req ["content-type"] = "application/json"
Req. body = json
Request (req)
End

Def post (uri, json)
Req = Net: HTTP: Post. new (uri)
Req ["content-type"] = "application/json"
Req. body = json
Request (req)
End

Def request (req)
Res = Net: HTTP. start (@ host, @ port) {| http |
Http. request (req)
}
If (not res. kind_of? (Net: HTTPSuccess ))
Handle_error (req, res)
End
Res
End

Private

Def handle_error (req, res)
E = RuntimeError. new ("# {res. code }:#{ res. message} \ nMETHOD:" +

"# {Req. method} \ nURI: # {req. path} \ n # {res. body }")
Raise e
End
End
End

Startup error:
$ Bin/couchdb
Apache CouchDB 0.9.0a691361-incubating (LogLevel = info) is starting.
{"Init terminating in do_boot", {badmatch, {error, shutdown}, [{couch_server_sup, start_server, 1}, {erl_eval, do_apply, 5}, {erl_eval, exprs, 5 },{ init, start_it, 1 },{ init, start_em, 1}]}
Crash dump was written to: erl_crash.dump
Init terminating in do_boot ()
Check the official wiki:
It turns out to be a folder installation permission problem.
Solution:
Sudo adduser couchdb
Chown-R couchdb: couchdb/usr/local/etc/couchdb
Chown-R couchdb: couchdb/usr/local/var/lib/couchdb
Chown-R couchdb: couchdb/usr/local/var/log/couchdb
Chown-R couchdb: couchdb/usr/local/var/run
Chmod-R 0770/usr/local/etc/couchdb
Chmod-R 0770/usr/local/var/lib/couchdb
Chmod-R 0770/usr/local/var/log/couchdb
Chmod-r 0770/usr/local/var/run
Start now and you will see the welcome page. All testsuite run success are done!

After CouchDB is started, CouchDB can be used normally. It seems that CouchDB is quite simple and quick to use. It provides almost all the language support and hopes CouchDB will grow better and better.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.