Install CouchDB on CentOS 8 - Step by Step Process ?

Apache CouchDB is an open-source database software that focuses on ease of use and having a scalable architecture. Apache CouchDB lets you access your data where you need it.

It embraces multiple protocols and formats for the storage and processing of data. CouchDB stores data in JSON format and leverages JavaScript for querying. 

Also, it boasts of a RESTFUL HTTP API for creating editing, and deleting documents.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related database queries.

In this context, we shall look into how to install and setup CouchDB on CentOS 8.


How to Install CouchDB on CentOS ?

To begin, we need to have an instance of CentOS 8 with sudo user already configured as well as an Access to your CentOS 8 via SSH or GUI.

Then proceed with the steps outlined below.


1. Enable the CouchDB repository on the local system

Right off the bat, access your instance of CentOS 8. We are first going to append the CouchDB repository to the local system first before installing it.

So, create a repository file in the /etc/yum.repos.d/ directory as shown:

$ sudo vim /etc/yum.repos.d/bintray-apache-couchdb-rpm.repo

Add the lines shown below:

[binary--apache-couchdb-rpm]
name=bintray--apache-couchdb-rpm
baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/
gpgcheck=0
repo_gpgcheck=0
enabled=1

Then save and exit from the repository file. With the repository in the palace, we shall proceed and install CouchDB.


2. Install CouchDB on your CentOS 8 system

The installation of CouchDB is quite simple and straightforward. Just invoke the command:

$ sudo dnf install couchdb

Press 'y' to proceed when prompted.

Upon completion of CouchDB installation, ensure enable CouchDB as follows.

$ sudo systemctl enable couchdb

Once enabled on boot time, start the service.

$ sudo systemctl start couchdb


3. Setting up CouchDB

According to the official documentation, CouchDB can exist in either a single-node or a cluster setup.

Here, we will demonstrate the configuration of CouchDB in a single-node setup.

On the command-line, we will define the admin user and the corresponding password.

To accomplish this, head over and edit the /opt/couchdb/etc/local.ini file:

$ sudo vim /opt/couchdb/etc/local.ini

Under the section [admins] section uncomment the line beginning with admin. 

By default, the password is set to mysecretpassword.

Ensure that you set a robust password to avert brute force attacks that might compromise your system.

Save the file.

Then proceed and restart CouchDB:

$ sudo systemctl restart couchdb

Lastly, we need to create system-wide databases. 

These are:

1. _users

2. _replicator

3. _global_changes

Use the curl command and invoke the commands below.

Be sure to replace admin_user and admin_password with your own values that you specified in the /opt/couchdb/etc/local.ini file:

$ curl -u admin_user:admin_password -X PUT http://127.0.0.1:5984/_users
$ curl -u admin_user:admin_password -X PUT http://127.0.0.1:5984/_replicator
$ curl -u admin_user:admin_password -X PUT http://127.0.0.1:5984/_global_changes


4. Verify the installation & setup of CouchDB

We are all caught up with the configurations. There are various ways of verifying that our installation was a success. 

On command-line execute the following curl command:

$ curl http://127.0.0.1:5984/

Some JSON information regarding the CouchDB instance will be printed on your terminal.

Alternatively, you can use the URL below on your browser to get similar JSON information in a more organized orientation:

http://127.0.0.1:5984/


How to Access CouchDB using a browser ?

Finally, to log in to your instance, browse the URL below:

$ 127.0.0.1:5984/_utils/

On the login page, key in the admin username and password defined previously.

Then hit the 'Log In' button.

On the dashboard, the databases you created in the previous step will be displayed.


[Need urgent assistance in fixing Packages installation on Debian Systems? We can help. ]

This article covers CouchDB installation on CentOS Linux System. 

Apache CouchDB is an open-source database management system, developed by Apache Software Foundation. It is a NoSQL document-store database developed in ErLang.

CouchDB uses multiple formats and protocols to store, transfer, and process its data, it uses JSON (JavaScript Object Notation) to store data, JavaScript as its query language using MapReduce, and HTTP for an API.

Unlike a relational database, a CouchDB database does not store data and relationships in tables. Instead, each database is a collection of independent documents. Each document maintains its own data and self-contained schema.

CouchDB software includes a native web interface i.e. Fauxton for administration of CouchDB database server.


To Install CouchDB Yum Repository on CentOS 8:

1. Create a repo file by using vim editor.

# vi /etc/yum.repos.d/bintray-apache-couchdb-rpm.repo

2. And add following directives in this file.

[bintray--apache-couchdb-rpm]
name=bintray--apache-couchdb-rpm
baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/
gpgcheck=0
repo_gpgcheck=0
enabled=1

3. Build cache for newly installed yum repositories.

# dnf makecache

4. Now we can install CouchDB software by using dnf command.

# dnf install -y couchdb

Related Posts