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 10 Buster.
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.
Step 1: Update System
Start by updating all system packages to the latest releases downloadable on the server.
sudo apt update
sudo apt -y upgrade
Step 2: Install Dependecies
Install all required dependencies to build CouchDB on Debian 10 Buster.
sudo apt update
sudo apt-get --no-install-recommends -y install build-essential pkg-config erlang libicu-dev libmozjs185-dev libcurl4-openssl-dev
Step 3: Create couchdb user for CouchDB
Create a couchdb
system user to run CouchDB service.
sudo adduser --system \
--shell /bin/bash \
--group --gecos \
"CouchDB Administrator" couchdb
Step 4: Build CouchDB on Debian 10 Buster
Download the latest stable release of CouchDB database archive.
curl -s https://api.github.com/repos/apache/couchdb/releases/latest \
| grep browser_download_url \
| cut -d '"' -f 4 \
| wget -qi -
Run the command below to build CouchDB on Debian 10 (Buster).
$ tar xvf apache-couchdb-*.tar.gz
$ cd apache-couchdb-*/
$ ./configure
To build CouchDB you should run:
$ make release
Try gmake
if make
is giving you any problems. If everything was successful you should see the following message:
Installing CouchDB into rel/couchdb/ ...
==> rel (generate)
WARN: 'generate' command does not apply to directory /root/apache-couchdb-2.3.1
... done
You can now copy the rel/couchdb directory anywhere on your system.
Start CouchDB with ./bin/couchdb from within that directory.
To install CouchDB into your system, copy the rel/couchdb
to your desired installation location.
sudo cp -r rel/couchdb /home/couchdb
sudo chown -R couchdb:couchdb /home/couchdb/
List directory contents:
$ ls -1 /home/couchdb/couchdb/ bin erts-10.2.4 etc lib LICENSE releases share var
Change the permission of the CouchDB directories by running:
find /home/couchdb -type d -exec chmod 0770 {} \;
chmod 0644 /home/couchdb/couchdb/etc/*
Step 5: Configure CouchDB Systemd Service
We need to create a coucdb systemd service for managing application status.
sudo tee /etc/systemd/system/couchdb.service<<EOF
[Unit]
Description=Couchdb service
After=network.target
[Service]
Type=simple
User=couchdb
ExecStart=/home/couchdb/couchdb/bin/couchdb -o /dev/stdout -e /dev/stderr
Restart=always
[Install]
WantedBy=multi-user.target
EOF
Reload systemd daemon.
sudo systemctl daemon-reload
sudo systemctl start couchdb.service
sudo systemctl enable couchdb.service
Confirm service status
$ systemctl status couchdb.service
● couchdb.service - Couchdb service
Loaded: loaded (/etc/systemd/system/couchdb.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2019-08-19 20:53:00 UTC; 1min 10s ago
Main PID: 15764 (beam.smp)
Tasks: 39 (limit: 4701)
Memory: 37.5M
CGroup: /system.slice/couchdb.service
├─15764 /home/couchdb/couchdb/bin/../erts-10.2.4/bin/beam.smp -K true -A 16 -Bd -- -root /home/couchdb/couchdb/bin/.. -progname couchdb -- -home /home/couchdb -- -boot /home/couchdb/couchdb/bin/../relea
├─15792 erl_child_setup 1024
├─15809 sh -s disksup
├─15811 /home/couchdb/couchdb/bin/../lib/os_mon-2.4.7/priv/bin/memsup
└─15812 /home/couchdb/couchdb/bin/../lib/os_mon-2.4.7/priv/bin/cpu_sup
Aug 19 20:53:21 localhost couchdb[15764]: [notice] 2019-08-19T20:53:21.761564Z [email protected] <0.356.0> --
Make sure CouchDB is still running, and then do:
$ curl http://127.0.0.1:5984/ {"couchdb":"Welcome","version":"2.3.1","git_sha":"c298091a4","uuid":"cf6f7c87e049c287e1459a53c8415c39","features":["pluggable-storage-engines","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
This issues a GET request to your newly installed CouchDB instance.
Test database creation:
$ curl -X PUT http://127.0.0.1:5984/testdb
{"ok":true}
$ curl -X PUT http://127.0.0.1:5984/testdb1
{"ok":true}
$ curl -X PUT http://127.0.0.1:5984/testdb2
{"ok":true}
$ curl -X GET http://127.0.0.1:5984/_all_dbs
["testdb","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.