Although MongoDB is faster than CouchDB, CouchDB does offer mobile support and replication, works with map-reduce functions, and supports both stand-alone and cluster deployments. One of the key differences between CouchDB and other databases is that it offers a flexible format for the storage of information.
Some of the more attractive features of CouchDB include the following:
- Easy database replication across multiple servers
- Fast indexing and retrieval
- REST-like interface
- JSON-based document format
- Multiple supported libraries
- Subscribable data updates on the _changes feed
I want to walk you through the process of installing CouchDB on Debian 11 Server. The process is fairly straightforward and shouldn’t take you more than five minutes to complete. I’ll demonstrate installing CouchDB in stand-alone mode (in a later piece I’ll walk you through deploying CouchDB as a cluster).
SEE: Hiring Kit: Database engineer (TechRepublic Premium)
What you’ll need
Since we’re going to install this in stand-alone mode, you’ll only need one instance of Debian Server and a user with sudo privileges.
How to install the dependencies
The first thing we’ll do is install the necessary dependencies. Log into your Debian server, and issue the command:
sudo apt-get install -y curl apt-transport-https gnupg nano lsb-release -y
How to add the CouchDB repository
Next, we’ll add the CouchDB repository. First, add the GPG key with:
curl https://couchdb.apache.org/repo/keys.asc | gpg --dearmor | sudo tee /usr/share/keyrings/couchdb-archive-keyring.gpg >/dev/null 2>&1
Then, add the repository with the command:
echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ `lsb_release -cs` main" \ | sudo tee /etc/apt/sources.list.d/couchdb.list >/dev/null
How to install CouchDB
Finally, we can install CouchDB with the commands:
sudo apt-get update
sudo apt-get install couchdb -y
During the installation, you’ll be prompted to configure CouchDB. First, you must select the type of configuration that meets your needs. Since we’re installing in stand-alone mode, make sure to select the correct option, tab down to OK, and hit Enter (Figure A).
Next, you’ll be required to type a cookie name (Figure B), which is used for all nodes in a cluster. Type anything you like here (such as trtest), tab down to OK, and hit Enter.
In the next window (Figure C), you’ll want to replace
0.0.0.0, so you can access the web-based GUI.
Finally, you must type and verify a password for the admin user (Figure D).
The installation will finish, and you’re ready to access the web-based GUI.
How to access the web-based GUI
Open a web browser and point it to
http://SERVER:5984/_utils/ (where SERVER is the IP address or domain of the hosting server). You will be presented with a login window (Figure E), where you’ll type the username admin and the password you created during the installation.
Once you’ve successfully authenticated, you’ll be presented with the main CouchDB web GUI, where you can start building your databases.
Congratulations, you now have a running instance of the CouchDB NoSQL database server. Next time around, we’ll deploy a CouchDB cluster for even more power.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.