How to install Apache CouchDB in Ubuntu?

Apache CouchDB is a free and open-source document database written in Erlang. It is classified as a NoSQL database and uses JSON to store data, JavaScript as its query language, and uses MapReduce and HTTP for API.

In this article, I will discuss how to install and use Apache CouchDB in Ubuntu Linux.

Prerequisites

You should have access to a user account with root user privileges to install required packages.

Installing CouchDB in Ubuntu

We will install CouchDB from its official repository. For this, we need to enable the CouchDB repository on our system.

First, install the required packages and dependencies by using –

sudo apt update && sudo apt install -y curl apt-transport-https gnupg

Use the following command to import the GPG key of the CouchDB repository –

curl https://couchdb.apache.org/repo/keys.asc | gpg --dearmor | sudo tee /usr/share/keyrings/couchdb-archive-keyring.gpg >/dev/null 2>&1

Next, enable the repository by using the given command –

echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ focal main" \
    | sudo tee /etc/apt/sources.list.d/couchdb.list >/dev/null

Refresh the local package repository list with –

sudo apt update

Finally use the following command to install CouchDB on your system.

sudo apt install couchdb

When ask for your confirmation type y and then press enter.

The installer will ask you to choose between standalone or clustered mode. We will install it in standalone mode, a clustered mode is when there are multiple servers are connected together.

couchdb in standalone

Next, it will ask you to enter the IP address, for standalone systems by default it is 127.0.0.1. If you want to bind all network interfaces then use 0.0.0.0.

configure ip

In the next window enter the password for the CouchDB ‘admin’ user.

set password admin

Enter your password once again.

confirm password

Verify the CouchDB installation

Once the installation is completed you can verify whether it was successfully installed on your system or not. The CouchDB server uses port 5984, now use the following command to verify CouchDB installation.

curl http://127.0.0.1:5984/

This will display the following output in JSON format.

verify installation

Access CouchDB web interface

Open a browser and enter the given URL to access the web interface of CouchDB.

http://127.0.0.1:5984/_utils/

web interface couchdb

Here you can log in to the CouchDB database as administrator by entering admin as username and password.

couchdb dashboard

Conclusion

To know more about CouchDB you can read Apache CouchDB documentation. For any query write us in the comments below.

Leave a Comment