• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Install Apache CouchDB on Ubuntu

{{postValue.id}}

To Install Apache CouchDB on Ubuntu

Apache Couchdb is commonly known as couchdb, developed by Apache Software Foundation. It is a NoSQL open source document-oriented database. CouchDB uses JSON to store data with documents so we can access from a web browser via HTTP and works smoothly with all latest modern web and mobile apps.

To prepare server for CouchDB

Before going to install couchdb update your repositories.

root@linuxhelp:~# apt-get update 
Hit http://in.archive.ubuntu.com wily InRelease
Hit http://in.archive.ubuntu.com wily-updates InRelease               
Hit http://security.ubuntu.com wily-security InRelease                   
.
.
.
Get:7 http://in.archive.ubuntu.com wily/universe amd64 Packages [6,704 kB]     
Get:8 http://in.archive.ubuntu.com wily/multiverse amd64 Packages [138 kB]     
Get:9 http://in.archive.ubuntu.com wily/main i386 Packages [1,416 kB]          
Get:10 http://in.archive.ubuntu.com wily/restricted i386 Packages [16.0 kB]    
Fetched 9,930 kB in 1min 43s (95.9 kB/s)                                       
Reading package lists... Done

Now install the package that allows you to manage the source repositories.

root@linuxhelp:~# apt-get install software-properties-common -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libavahi-client-dev libavahi-common-dev libavahi-compat-libdnssd1
  libdbus-1-dev libjs-jquery libruby2.1 libyaml-0-2 ruby2.1
  rubygems-integration
.
.
.
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.58ubuntu1) ...
Setting up python3-software-properties (0.96.13.1) ...
Setting up software-properties-common (0.96.13.1) ...
Setting up software-properties-gtk (0.96.13.1) ...

Now we need to add the PPA repository to install CouchDB by running the following command.

root@linuxhelp:~# add-apt-repository ppa:couchdb/stable -y
gpg: keyring `/tmp/tmpdlpga6gq/secring.gpg'  created
gpg: keyring `/tmp/tmpdlpga6gq/pubring.gpg'  created
gpg: requesting key C17EAB57 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpdlpga6gq/trustdb.gpg: trustdb created
gpg: key C17EAB57: public key " Launchpad PPA for Apache CouchDB"  imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

After adding PPA repositories update your repositories

root@linuxhelp:~# apt-get update 
Get:1 http://security.ubuntu.com wily-security InRelease [65.9 kB]
Hit http://in.archive.ubuntu.com wily InRelease                                
Get:2 http://in.archive.ubuntu.com wily-updates InRelease [65.9 kB]            
Get:3 http://ppa.launchpad.net wily InRelease [15.4 kB]                        
Hit http://in.archive.ubuntu.com wily-backports InRelease                      
.
.
.       
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en      
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en      
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en        
Fetched 1,436 kB in 14s (101 kB/s)                                             
Reading package lists... Done

To Install CouchDB

Execute the following command to install the CouchDB.

root@linuxhelp:~# apt-get install couchdb -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libavahi-client-dev libavahi-common-dev libavahi-compat-libdnssd1
  libdbus-1-dev libjs-jquery libruby2.1 libyaml-0-2 ruby2.1
  rubygems-integration
.
.
.
Setting up couchdb (1.6.1-0ubuntu6ppa2~wily1) ...
Setting up lksctp-tools (1.0.16+dfsg-2) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...

By defaults, CouchDb runs under localhost and it has port number as 5984. You can verify about couchdb on your browser by using the URL http://localhost:5984 or else install curl to verify it using curl command.

root@linuxhelp:~# apt-get install curl -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libavahi-client-dev libavahi-common-dev libavahi-compat-libdnssd1
  libdbus-1-dev libjs-jquery libruby2.1 libyaml-0-2 ruby2.1
.
.
.
Processing triggers for man-db (2.7.4-1) ...
Setting up libcurl3-gnutls:amd64 (7.43.0-1ubuntu2.1) ...
Setting up curl (7.43.0-1ubuntu2.1) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...

Now run the following command to verify.

root@linuxhelp:~# curl localhost:5984
{" couchdb" :" Welcome" ," uuid" :" 363ff0099f4129f2be84af6c8984d2ff" ," version" :" 1.6.1" ," vendor" :{" version" :" 15.10" ," name" :" Ubuntu" }}

To create a CouchDB Database

We able to create database in couchdb in two ways either using command line or using browser interface. To create a database via command line run the following command.

root@linuxhelp:~# curl -X PUT localhost:5984/new_database
{" ok" :true}

To Secure CouchDb Installation

Now we need to secure CouchDB by changing the user and group ownership for couchdb. Before changing the ownership stop couchdb by executing the following command.

root@linuxhelp:~# stop couchdb
stop: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

We are getting error because of running Ubuntu in a virtual host. To fix this we need to modify initctl by the following two commands and then try to stop couchdb

root@linuxhelp:~# dpkg-divert --local --rename --add /sbin/initctl
Adding ' local diversion of /sbin/initctl to /sbin/initctl.distrib'  
root@linuxhelp:~# ln -s /bin/true /sbin/initctl
root@linuxhelp:~# stop couchdb

Now change the ownership for /usr/share/couchdb, /etc/couchdb and /usr/bin/couchdb directories.

root@linuxhelp:~# chown -R couchdb:couchdb /usr/share/couchdb /etc/couchdb /usr/bin/couchdb

And set the permission for the same directories and give complete access to couchdb users and group

root@linuxhelp:~# chmod -R 0770 /usr/share/couchdb /etc/couchdb /usr/bin/couchdb

Finally start CouchDB.

root@linuxhelp:~# start couchdb

Now we can access the couchdb from the web browser by using the below URL

http://localhost:5984/_utils


overview

Now we need to create admin user for couchdb. Without admin user, all users will be considered as admin by default. To create admin user select “ Fix this” that should appears in the bottom right corner as shown below.


create_database

Now enter the username and password for your admin user and select “ create” .

create_server_admin

To create a Database select “ Create Database”

select

Now enter the name for your database and select “ Create” .

create_files

Inside the database select “ New Document” to create a new document in the database.

new_document

Here you can add any fields an values to the document as follows.

add_field
set_password
passqord
id

Now save the document

save_document
created database

Tags:
benjamin
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Can I talk to CouchDB without going through the HTTP API?

A

CouchDB's data model and internal API map the REST/HTTP model so well that any other API would basically reinvent some flavour of HTTP.

Q

How Do I Use Replication in CouchDB?

A

By using this steps and commands
POST /_replicate
{"source":"$source_database","target":"$target_database"}

Q

How do I use transactions with Apache CouchDB?

A

CouchDB uses an "optimistic concurrency" model you send a document version along with your update, and CouchDB rejects the change if the current document version doesn't match what you've sent.

Q

What data recovery strategies exist?

A

These are the traditional data backup strategies for CouchDB:
Replication
Database file backup
Filesystem snapshots

Q

It is possible to add SSL to CouchDB?

A

Yes, It is possible to add SSL to CouchDB. Apache CouchDB leverages Erlang/OTP's SSL, which is usually linked against a system-provided OpenSSL installation.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.