Install CouchDB on Ubuntu 20.04

Install CouchDB on Ubuntu 20.04

CouchDB is a cross-platform document database released by the Apache Software Foundation. CouchDB is classified as a NoSQL database. So it stores data in JSON-based document format. CouchDB is an open-source project written in the Erlang programming language.

This tutorial demonstrates how to install CouchDB on Ubuntu 20.04.

Install CouchDB

Download GPG key:

sudo wget -qO /etc/apt/trusted.gpg.d/couchdb-key.asc https://couchdb.apache.org/repo/keys.asc

Add the CouchDB repository:

echo "deb https://apache.jfrog.io/artifactory/couchdb-deb/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/couchdb.list

Run the following command to update the package lists:

sudo apt update

We will use non-interactive installation. So define the following answers which will be used during installation:

sudo debconf-set-selections <<< "couchdb couchdb/adminpass string pwd123"
sudo debconf-set-selections <<< "couchdb couchdb/adminpass_again string pwd123"
sudo debconf-set-selections <<< "couchdb couchdb/bindaddress string 0.0.0.0"

Don't forget to change admin password.

Note that 0.0.0.0 binds CouchDB to all network interfaces. So it accepts connections from any IPv4 address.

Install the CouchDB:

sudo DEBIAN_FRONTEND=noninteractive apt install -y couchdb

To make sure that CouchDB service is running you can use the following command:

sudo service couchdb status

We can also stop, start and restart the CouchDB service:

sudo service couchdb stop
sudo service couchdb start
sudo service couchdb restart

Testing CouchDB

Open your browser and navigate to http://<IP_ADDRESS>:5984/_utils, where <IP_ADDRESS> is IP address of your machine. Type admin username and password to login to administration panel.

CouchDB administration panel on Ubuntu

Uninstall CouchDB

If you wish to completely remove CouchDB and related dependencies, execute the following command:

sudo DEBIAN_FRONTEND=noninteractive apt purge --autoremove -y couchdb

Remove GPG key and repository:

sudo rm -rf /etc/apt/trusted.gpg.d/couchdb-key.asc
sudo rm -rf /etc/apt/sources.list.d/couchdb.list

Remove CouchDB user:

sudo deluser couchdb

You can also remove CouchDB data:

sudo rm -rf /var/lib/couchdb

Leave a Comment

Cancel reply

Your email address will not be published.