How to install CouchDB on CentOS 7

CouchDB might be your best option when creating a custom app or service that requires a simple, scalable database. Find out how to install this NoSQL database on CentOS 7.

Image: Jack Wallen

CouchDB is a free, open source NoSQL database developed by the Apache Foundation. This particular database focuses on ease of use and scalability. CouchDB has a document-oriented NoSQL database architecture, uses JSON to store data, it uses Javascript as its query language and HTTP as its API.

CouchDB is unlike a relational database, in that each database is a collection of independent documents with each document maintaining its own data and self-contained schema. Because of its outstanding replication and synchronization capabilities, CouchDB makes an ideal database for mobile device apps and similar service-based needs. This NoSQL database is also perfectly suited for applications with accumulating data (where versioning is key), such as CRM and CMS systems.

SEE: Hiring kit: Database administrator (Tech Pro Research)

I want to walk you through the process of installing CouchDB on CentOS 7.

What you need

The only things you need to make this work is a running instance of CentOS 7 and a user account with sudo privileges.

Installing CouchDB

The first thing you need to do is to install the database. Before you do that, you must install the necessary repository. You will also need to install the epel-release repository (to pick up a few dependencies), which can be done with the command:

sudo yum install epel-release -y

When that completes, it's time to add the CouchDB repository. Issue the following command to create the necessary file:

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

In this new file, paste the following:


Save and close that file. Now you can install CouchDB with the following command:

sudo yum install couchdb -y

When that completes, start and enable the database service with the commands:

sudo systemctl start couchdb
sudo systemctl enable couchdb

Configuring CouchDB

There are two basic configurations to do both of which are taken care of in the same config file. In your terminal window, issue the command:

sudo nano /opt/couchdb/etc/local.ini

In that file, look for the [chttpd] section (Figure A). By default CouchDB only listens to localhost, so you cannot connect to the database from any machine that is not the host. Change the line:

;bind_address =


bind_address =
Figure A

Figure A: Configuring CouchDB to listen outside of localhost.

Next scroll to the bottom of the file and look for the [admins] section. Here you want to define the admin user password like so:

admin = PASSWORD

where PASSWORD is a strong, unique password (Figure B).

Figure B

Figure B: Configuring the admin password for CouchDB.

Save and close that file. To hash the newly added password, restart the CouchDB service with the command:

sudo systemctl restart couchdb

Testing the connection

There are two ways to test your newly installed CouchDB system. The first is using the curl command like so:

curl http://SERVER_IP:5984

where SERVER_IP is the IP address of the CouchDB server. You should see a Welcome message that includes the CouchDB version number and a few more bits of information (Figure C).

Figure C

Figure C: A successful connection to the CouchDB server.

The web interface

Thanks to Fauxton, CouchDB includes a handy web-based interface. Point your browser to http://SERVER_IP:5984/_utils/ (where SERVER_IP is the IP address of your hosting server) and log in with the user admin and the password you set in the configuration file. Once logged in, you can start creating databases and documents (Figure D).

Figure D

Figure D: The CouchDB web-based interface.

And that's all there is to installing and configuring the CouchDB database on your CentOS 7 data center server. This new NoSQL database is ready for use in whatever manner is necessary for your business. Next time we visit CouchDB, we'll start creating databases with both the command line and the web interface.

Also see