How to Install CouchDB on Ubuntu 18.04

Updated on

2 min read

Install CouchDB on Ubuntu 18.04

CouchDB is a free and open-source fault-tolerant NoSQL database maintained by the Apache Software Foundation.

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. It includes a RESTful HTTP API that allows you to read, create, edit and delete database documents.

In this tutorial, we will cover the process of installing the latest version of CouchDB on Ubuntu 18.04.

Prerequisites

Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges .

Enabling CouchDB repository

Start by adding the CouchDB GPG key to your system using the following command:

curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -

Once the key is imported, add the CouchDB repository with:

echo "deb https://apache.bintray.com/couchdb-deb bionic main" | sudo tee -a /etc/apt/sources.list

Installing CouchDB on Ubuntu

Now that the repository is enabled update the packages list and install CouchDB:

sudo apt updatesudo apt install couchdb

During the installation, you will be asked whether you want to install CouchDB in a standalone or clustered mode. We will install the CouchDB in a single-server standalone mode.

CouchDB Select 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 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 will cause CouchDB to binds to all network interfaces.

CouchDB Select Interface

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.

CouchDB Create Admin

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

CouchDB Confirm Password

Verifying CouchDB Installation

To verify whether the installation has completed successfully run the following curl command which will print the CouchDB database information in JSON format:

curl http://127.0.0.1:5984/

The output will look like this:

{  
   "couchdb":"Welcome",
   "version":"2.3.1",
   "git_sha":"07ea0c7",
   "uuid":"1d2074b5eb428c30240e0c7384036acf",
   "features":[  
      "pluggable-storage-engines",
      "scheduler"
   ],
   "vendor":{  
      "name":"The Apache Software Foundation"
   }
}

For clarity the output is formatted.

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

http://127.0.0.1:5984/_utils/
CouchDB Fauxton

Conclusion

You have learned how to install CouchDB Ubuntu 18.04. Your next step could be to visit the Apache CouchDB Documentation and find more information on this topic.

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