Databases

How To Install Apache CouchDB on Debian 11/10

Apache CouchDB is an open-source document-oriented NoSQL database written in Erlang with concurrency and fault-tolerance in mind. Its development and releases are under Apache Software Foundation. CouchDB uses JSON to represent data stored in a database. The CouchDB replication allows you to synchronize two or more CouchDB databases. CouchDB RESTful HTTP/JSON API allows you to read, edit, delete and create database documents. In this guide, we will explain how to install CouchDB on Debian.

Original content from computingforgeeks.com - post 25376

You need to have SSH access to a server as a user with sudo privileges. Once this is confirmed, access your server via terminal and follow the next steps shared below.

Update System

Start by updating all system packages to the latest releases downloadable on the server.

sudo apt update && sudo apt -y upgrade

Check and perform system reboot if needed.

[ -e /var/run/reboot-required ] && sudo reboot

Install Dependecies required

Install all required dependencies to build CouchDB on Debian.

sudo apt update
sudo apt --no-install-recommends -y install build-essential pkg-config erlang libicu-dev libmozjs*-dev libcurl4-openssl-dev

Install Apache CouchDB Database

Install dependencies.

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

Import repository GPG key.

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

Source OS details.

source /etc/os-release

Configure APT repository:

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

Update package APT index and install CouchDB

sudo apt update && sudo apt install -y couchdb

Set CouchDB magic cookie.

Apache CouchDB Debian 01

Set bind address. If you need to access from outside set 0.0.0.0

Apache CouchDB Debian 02

Provide admin user password used to authenticate at later stage.

Apache CouchDB Debian 03

Confirm the password to complete installation.

Apache CouchDB Debian 04

Start Apache CouchDB service

Reload systemd daemon.

sudo systemctl daemon-reload

Start and enable services.

sudo systemctl start couchdb.service
sudo systemctl enable couchdb.service

Confirm service status

$ systemctl status couchdb.service
 couchdb.service - Apache CouchDB
     Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-09-21 22:21:39 UTC; 1min 18s ago
   Main PID: 7151 (beam.smp)
      Tasks: 29 (limit: 4539)
     Memory: 51.8M
        CPU: 2.233s
     CGroup: /system.slice/couchdb.service
             ├─7151 /opt/couchdb/bin/../erts-12.3.2.10/bin/beam.smp -SDio 16 -Bd -- -root /opt/couchdb/bin/.. -progname couchdb -- -home /opt/couchdb -- -boot /opt/couchdb/bin/../releases/3.3.2/cou>
             ├─7167 erl_child_setup 65536
             ├─7197 inet_gethost 4
             └─7198 inet_gethost 4

Sep 21 22:21:39 debian11 systemd[1]: Started Apache CouchDB.

Testing Apache CouchDB installation

Make sure CouchDB is still running, and then do:

$ curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"3.3.2","git_sha":"11a234070","uuid":"37ede4300f754902980f95b024c3a749","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

This issues a GET request to your newly installed CouchDB instance.

Username and Password set earlier can be provided while installing using command syntax:

curl http://admin:[email protected]:5984

This returns the database information:

{"couchdb":"Welcome","version":"3.3.2","git_sha":"11a234070","uuid":"37ede4300f754902980f95b024c3a749","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

Test database creation:

$ curl -X PUT http://127.0.0.1:5984/testdb
{"ok":true}

$  curl -X PUT http://admin:[email protected]:5984/testdb1
{"ok":true}

$  curl -X PUT http://admin:[email protected]:5984/testdb2
{"ok":true}

$ curl -X GET http://admin:[email protected]:5984/_all_dbs
["_replicator","_users","testdb1","testdb2"]

You can access CouchDB web-based interface, Fauxton at:

http://127.0.0.1:5984/_utils/

Visit CouchDB documentation website for more reading.

Related Articles

Debian How To Install Usermin on Ubuntu or Debian Debian Install VSCodium on Ubuntu|Debian|Linux Mint Databases How To Install MongoDB 6 on Debian 12/11/10 Containers Run Microsoft SQL Server 2022 in Docker / Podman Container

Leave a Comment

Press ESC to close