Site icon CentLinux

How to install CouchDB Server on CentOS 8

Share on Social Media

Discover how to install CouchDB Server on CentOS 8 with our detailed guide. Follow step-by-step instructions to set up CouchDB for efficient data storage and management on your Linux system. #centlinux #linux #couchdb

What is Apache CouchDB?

Apache CouchDB is an open-source NoSQL database management system that emphasizes ease of use, scalability, and flexibility. Here are key points about Apache CouchDB:

  1. Document-Oriented: CouchDB stores data in JSON-like documents, making it flexible for storing semi-structured and unstructured data.
  2. Distributed Architecture: Designed for distributed computing environments, CouchDB supports multi-master replication. This means multiple databases can synchronize changes bidirectionally.
  3. ACID Compliance: CouchDB ensures data integrity and consistency through ACID (Atomicity, Consistency, Isolation, Durability) properties for individual documents.
  4. HTTP Protocol: CouchDB uses HTTP and JSON for its API, allowing easy integration with web applications and straightforward data manipulation using standard HTTP methods (GET, PUT, POST, DELETE).
  5. MapReduce Views: CouchDB allows developers to create views using JavaScript for querying and aggregating data. Views are built using MapReduce functions and can be indexed for faster query execution.
  6. Conflict Resolution: Provides built-in conflict resolution mechanisms to handle concurrent updates to the same document across distributed databases.
  7. Fault Tolerance and Scalability: Designed to be fault-tolerant and scalable, CouchDB can handle large volumes of data and concurrent users.
  8. Cross-Platform: Apache CouchDB is cross-platform and runs on various operating systems, including Linux, macOS, and Windows.
  9. Use Cases: CouchDB is suitable for applications requiring offline-first capabilities, decentralized synchronization, and flexible data modeling. It is used in content management systems, mobile apps, IoT (Internet of Things) applications, and more.

Apache CouchDB is maintained by the Apache Software Foundation and is available under the Apache License, making it free to use and modify. It is known for its ease of setup and administration, making it accessible to developers looking for a scalable and flexible database solution.

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

Recommended Online Training: Understanding CouchDB 3: Learn Basic & Advanced NoSQL Skills

Couchbase vs CouchDB

Couchbase and CouchDB are both NoSQL database systems, but they have some key differences in terms of architecture, features, and use cases:

Couchbase

Architecture

Data Model

Querying

Scalability and Performance

Use Cases

CouchDB

Architecture

Data Model

Querying

Consistency and Conflict Resolution

Use Cases

Summary

Choosing between Couchbase and CouchDB depends on specific project requirements such as scalability needs, querying capabilities, and architectural preferences for data synchronization and consistency. Each database system offers unique strengths tailored to different use cases in modern application development.

Read Also: How to install Couchbase Server on CentOS 8

Environment Specification

We are using a minimal installed CentOS 8 virtual machine with following specification.

Update your Linux Server

Connect with couchdb-01.centlinux.com as root user by using a ssh client.

It is a best practice to update installed software packages before installing anything new on Linux operating system.

Execute dnf command to update installed software packages in your Linux operating system.

# dnf -y update

After updating software packages, verify the new Kernel version.

# uname -r
4.18.0-193.6.3.el8_2.x86_64

Install EPEL Yum Repository

CouchDB database server requires some packages that are not available in standard yum repositories, therefore, you have to install EPEL (Extra Packages for Enterprise Linux) yum repository on your Linux server.

# dnf install -y epel-release

Install CouchDB Yum Repository

CouchDB database can be install on Linux from source or RPM packages. The RPM based installation is simple and straight forward, therefore we suggest that you should install this NoSQL database software from RPM packages.

Free RPM packages are distributed through their own official yum repository. Therefore, you need to install CouchDB yum repository in your Linux operating system.

Create a repo file by using vim text editor.

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

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

Build cache for newly installed yum repositories.

# dnf makecache
CentOS-8 - AppStream                            2.7 kB/s | 4.3 kB     00:01
CentOS-8 - Base                                 1.4 kB/s | 3.9 kB     00:02
CentOS-8 - Extras                               1.4 kB/s | 1.5 kB     00:01
bintray--apache-couchdb-rpm                     489  B/s | 1.3 kB     00:02
Extra Packages for Enterprise Linux Modular 8 -  12 kB/s | 117 kB     00:10
Extra Packages for Enterprise Linux 8 - x86_64  215 kB/s | 7.9 MB     00:37
Metadata cache created.

Install CouchDB Server on CentOS 8

You have set up the required yum repositories. Now you can install CouchDB Server on CentOS 8 by using dnf command.

# dnf install -y couchdb

NoSQL database software is installed in /opt/couchdb directory.

Edit CouchDB configuration file by using vim text editor.

# vi /opt/couchdb/etc/local.ini

Create an admin user and set a strong password for it. You have to locate the [admins] section and then add a admin user under this section. You can add as many admin users as you like here.

[admins]
admin = Str0ngP@ssw0rd

Don’t worry about the password in plain text, because the CouchDB will automatically convert it to a hash at the time of service startup.

By default, CouchDB runs its Web UI (i.e. Fauxton) at the localhost interface only. But to access it from the network, you need to run it on other network interfaces as well.

Locate [chttpd] section and set following directives therein.

[chttpd]
port = 5984
bind_address = 0.0.0.0

Enable and start CouchDB service.

# systemctl enable --now couchdb.service
Created symlink /etc/systemd/system/multi-user.target.wants/couchdb.service â /usr/lib/systemd/system/couchdb.service.

Configure Linux Firewall

CouchDB service uses default port 5984/tcp. Therefore, you need to allow incoming traffic to this port from the network.

Execute firewall-cmd command to allow port 5984/tcp in Linux firewall.

# firewall-cmd --permanent --add-port=5984/tcp
success
# firewall-cmd --reload
success

Accessing Fauxton Web UI

After successful startup of CouchDB service, you can now access the Fauxton web interface by opening the URL http://couchdb-01.centlinux.com:5984/_utils#setup in a web browser.

CouchDB Login

You will be redirected to the login page. You can use an admin user (that we have added in local.ini file) to login to Fauxton.

Setup Apache CouchDB

After login, the setup will ask you to configure CouchDB server as a single-node instance or set up a cluster. Click on “Configure as Single Node”.

CouchDB Admin Credentials

Provide the admin user credentials, bind IP address and the service port. Click on “Configure Node”.

CouchDB – Configure Database Replication

At the end of setup, it will ask you to configure replication. Ignore it and click on the Databases button at left sidebar.

CouchDB Databases

You are now at the databases page. You can create your required databases from this page.

In the above screenshot, you can see the two system databases that are created during setup process and two user databases that are created by us for testing purpose.

Besides Fauxton web interface, you can also send HTTP commands to CouchDB instance by using curl command.

To create a CouchDB database, you can execute following command at Linux bash prompt.

# curl -u admin:Str0ngP@ssw0rd -X PUT http://127.0.0.1:5984/prod
{"ok":true}

To list all the databases on your CouchDB server, you can send following command.

# curl -u admin:Str0ngP@ssw0rd -X GET http://127.0.0.1:5984/_all_dbs
["_replicator","_users","prod","test"]

To understand basics and architecture of CouchDB database, we recommend that you should buy and read CouchDB: The Definitive Guide: Time to Relax (PAID LINK) by O’Reilly Media.

Final Thoughts

Installing CouchDB Server on CentOS 8 opens up robust possibilities for scalable and efficient data storage solutions. Whether you’re a developer or system administrator, mastering CouchDB enhances your ability to manage and optimize data storage on CentOS 8.

For personalized assistance or detailed instructions on installing CouchDB Server, explore my Fiverr service: Linux Server Administration

Empower your data management capabilities with expert support today!

Exit mobile version