How to Install CouchDB on Ubuntu 20.04

Apache CouchDB is a free, open-source document-oriented NoSQL database developed and maintained by the Apache Software Foundation, first created in 2005. CouchDB can be installed and ran in two different modes: standalone or clustered, and uses multiple formats and protocols to store, transfer, and process its data. The database structure uses JSON to store data, JavaScript as its query language using MapReduce, and HTTP for an API.

In the following guide, you will learn how to install CouchDB and create a database using their web UI on your Ubuntu 20.04 LTS operating system.

Prerequisites

  • Ubuntu 20.04 OS (20.10 and 21.04 can be used)
  • Update to date system packages
  • Root access or sudo privilages.
  • Common properties and Curl installed.
sudo apt update && sudo apt upgrade -y

Next, install the required packages.

sudo apt install software-properties-common wget

Download GPG Key CouchDB

Now you need to download the GPG key for the repository to install CouchDB and receive further updates in the future automatically when running the apt package manager update command.

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

Now, add the repository.

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

An example output:

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

Install CouchDB

Once the repository is added, you will need to update the package manager to sync the new repo, and you can then install CouchDB onto your Ubuntu 20.04 system.

sudo apt update && sudo apt install couchdb -y

Once you have started the installation process, you will see a screen pop up very quickly.

install couchdb ubuntu 20.04 start configuration

Configuration Mode Choice

You will need to select ok to proceed to the next screen. Note you will need to hit the tab key on your keyboard to select the ok. Once done, hit enter. When you get to the second part, choose the Standalone server option.

install couchdb ubuntu 20.04 standalone

IP Address Configuration

The next option in the configuration is to set the IP address of the network interface to which CouchDB will bind. Again, if you run a single server, you do not need to modify the default “127.0.0.1” address.

install couchdb ubuntu 20.04 set ip address

Create Password

You now create an admin account. It will ask you for a password to proceed further. Type it in and select ok. It is not recommended to skip this step. By leaving blank, you leave a security loophole in the future.

install couchdb ubuntu 20.04 create password for admin

CouchDB Status Check

By default, the software should be automatically enabled at startup and already on. To check, enter the following.

sudo systemctl status couchdb

Example output should be:

~$ sudo systemctl status couchdb
 ● couchdb.service - Apache CouchDB
      Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor prese>
      Active: active (running) since Sat 2021-06-19 07:50:41 PDT; 42s ago
    Main PID: 14835 (beam.smp)
       Tasks: 38 (limit: 4617)
      Memory: 34.9M
      CGroup: /system.slice/couchdb.service
              ├─14835 /opt/couchdb/bin/../erts-9.3.3.14/bin/beam.smp -K true -A >
              ├─14847 /opt/couchdb/bin/../erts-9.3.3.14/bin/epmd -daemon
              ├─14866 erl_child_setup 65536
              ├─14894 inet_gethost 4
              └─14895 inet_gethost 4
 Jun 19 07:50:41 ubuntu systemd[1]: Started Apache CouchDB.

Create a New CouchDB Database

You can add a new database using CouchDB with the username “admin” and the password you set for the account during the initial install configuration. This can be accessed through CouchDB’s Fauxton web UI control panel that comes installed with the package.

To launch Fauxton, enter the following in your browser.

http://127.0.0.1:5984/_utils/
install couchdb ubuntu 20.04 admin login

Once logged in, you will see a create a database link with an icon in the top right-hand corner. Select this, which will then bring up a “Create Database” screen. Enter the name testdb and select partitioned or non-partitioned, then click on the Create button to continue.

install couchdb ubuntu 20.04 create database

Now back on the database page, you can see the new database you created.

install couchdb ubuntu 20.04 database page

Comments and Conclusion

The guide has shown you how to install CouchDB and create a database using the software’s inbuilt web UI Fauxton. To find out more information on what you can do with CouchDB or more configuration options in a live environment, see their documentation.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!