How to Install CouchDB on Ubuntu 20.04

Posted 

3 min read

Apache CouchDB is a free and open-source NoSQL database developed by the Apache Software Foundation. It can be used as a single-node or clustered database.

CouchDB server stores its data in named databases, which contains documents with JSON structure. Each document consists of a number of fields and attachments. Fields can include text, numbers, lists, booleans, more. CouchDB includes a RESTful HTTP API that allows you to read, create, edit, and delete database documents.

This article covers the steps of installing the latest version of CouchDB on Ubuntu 20.04.

Installing CouchDB on Ubuntu is relatively straightforward. We’ll enable the CouchDB APT repository, import the repository GPG key, and install the CouchDB package.

Enabling CouchDB repository

Run the following commands as root or user with sudo privileges to enable the CouchDB repository and import GPG key:

curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -echo "deb https://apache.bintray.com/couchdb-deb focal main" | sudo tee -a /etc/apt/sources.list

Installing CouchDB on Ubuntu

Once the repository is enabled, update the packages list and install CouchDB:

sudo apt updatesudo apt install couchdb

The installer will ask you whether you want to install CouchDB in a clustered or standalone mode. A cluster means multiple servers connected together, working as a single, distributed data store.

We will install CouchDB in a single-server standalone mode.

Next, you’ll be given an option to set the IP address of the network interface on which the CouchDB will bind to. For a single-server setup, leave the default 127.0.0.1. If you are configuring a cluster, enter the interface IP address or type 0.0.0.0, which tells CouchDB to binds to all network interfaces.

On the next prompt, set the admin password. It is highly recommended to set the password, which will take CouchDB out of the insecure “admin party” mode. If you leave this field blank, an admin user will not be created.

Finally, confirm the password, and the CouchDB installation will continue.

Verifying CouchDB Installation

The CouchDB server is running at localhost:5984. To verify whether the installation was successful and the service is running, run the following curl command that will print information about the CouchDB database in JSON format:

curl http://127.0.0.1:5984/

The output will look like this:

{
  "couchdb":"Welcome",
  "version":"3.1.0",
  "git_sha":"ff0feea20",
  "uuid":"4589130c33b0dae4c166330463542ad4",
  "features":[
    "access-ready",
    "partitioned",
    "pluggable-storage-engines",
    "reshard",
    "scheduler"
  ],
  "vendor":{
    "name":"The Apache Software Foundation"
  }
}

For clarity the output above is formatted.

If you prefer GUI, you can access the CouchDB web-based interface, Fauxton at:

http://127.0.0.1:5984/_utils/

Conclusion

We’ve shown you how to install CouchDB on Ubuntu 20.04. You can find more information on this topic in the Apache CouchDB Documentation .

Feel free to leave a comment if you have any questions.