How To Install Apache CouchDB on CentOS 8

On this article we will discuss how to install Apache CouchDB on CentOS 8 operating system.
Introduction
Increasing human activity will be correlated with increasing data generated. The use of social media, shopping transactions, uploading video tutorials, and so on will produce more data exponentially. The use of relational databases, which have dominated for decades, is felt to be heavy enough to accommodate the exponential data generated at this time. There are currently many NoSQL databases available and in use, including: MongoDB, Redis, CouchDB which are usually initiated by the open source community. CouchDB as a noSQL database has its own fan base and is used in applications that running a business. On this occasion, we will discuss how to install CouchDB on CentOS 8.
Apache CouchDB Installation on CentOS 8
Before we are going to start the installation, we need to prepare our system environment is supports for the Apache CouchDB installation process.
The Couchdb installation process will consist of several steps, namely:
- Prerequisite
- Installing the EPEL Repository CentOS 8
- Enabling the CouchDB Repository
- Installing CouchDB on CentOS 8
- Starting and Enabling CouchDB
- Enabling Firewall
- Verifying CouchDB
Prerequisite
Before we are going to install Apache Kafka on CentOS 8, we have to prepare the environment first.
- CentOS 8 System
- root or ordinary account with sudo privilege
- Sufficient disk space
1. Installing the EPEL Repository CentOS 8
EPEL (Extra Packages for Enterprise Linux) is repository project from Fedora team that provides an easy access to install packages for commonly used software. EPEL project is not a part of RHEL/CentOS but it was designed for major Linux distributions. EPEL provides lots of open source packages like networking tools, sysadmin tools, programming, monitoring and other tools. Most of the EPEL packages are maintained by Fedora repo. At this article, we will discuss how to install EPEL on Centos 7.
$ sudo dnf install epel-release -y
output will be as follow :
[ramans@otodiginet ~]$ sudo dnf install epel-release -y [sudo] password for ramans: Elasticsearch repository for 7.x packages 2.0 kB/s | 1.3 kB 00:00 Elasticsearch repository for 7.x packages 824 kB/s | 17 MB 00:20 ELRepo.org Community Enterprise Linux Repositor 1.3 kB/s | 2.9 kB 00:02 ELRepo.org Community Enterprise Linux Repositor 101 kB/s | 310 kB 00:03 Extra Packages for Enterprise Linux Modular 8 - 4.4 kB/s | 8.3 kB 00:01 Extra Packages for Enterprise Linux Modular 8 - 73 kB/s | 132 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 6.3 kB/s | 7.5 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 133 kB/s | 8.0 MB 01:01 MySQL 8.0 Community Server 12 kB/s | 2.5 kB 00:00 MySQL Connectors Community 20 kB/s | 2.5 kB 00:00 MySQL Tools Community 20 kB/s | 2.5 kB 00:00 Oracle Linux / RHEL / CentOS-8 / x86_64 - Virtu 364 B/s | 181 B 00:00 Package epel-release-8-8.el8.noarch is already installed. Dependencies resolved. Nothing to do. Complete!
2. Enabling CouchDB Repository
To enable CouchDB repository on Centos 8 operating system, we just add a new file and set the its extension name to .repo.
$ sudo vi /etc/yum.repos.d/apache-couchdb.repo
output :
[ramans@otodiginet ~]$ sudo vi /etc/yum.repos.d/apache-couchdb.repo [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. Installing CouchDB on CentOS 8
It is easy to install CouchDB when all prerequisites are fulfilled. To install CouchDB on CentOS 8 we just submit the following command line :
$ sudo dnf install couchdb -y
output will be as follow :
[ramans@otodiginet ~]$sudo dnf install couchdb -y bintray--apache-couchdb-rpm 26 kB/s | 94 kB 00:03 Last metadata expiration check: 0:00:01 ago on Fri 25 Sep 2020 10:00:02 AM PDT. Dependencies resolved. ===================================================================================== Package Arch Version Repository Size ===================================================================================== Installing: couchdb x86_64 3.1.1-1.el8 bintray--apache-couchdb-rpm 24 M Transaction Summary ===================================================================================== Install 1 Package Total download size: 24 M Installed size: 51 M Downloading Packages: couchdb-3.1.1-1.el8.x86_64.rpm 881 kB/s | 24 MB 00:27 ------------------------------------------------------------------------------------- Total 881 kB/s | 24 MB 00:27 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: couchdb-3.1.1-1.el8.x86_64 1/1 Installing : couchdb-3.1.1-1.el8.x86_64 1/1 Running scriptlet: couchdb-3.1.1-1.el8.x86_64 1/1 Verifying : couchdb-3.1.1-1.el8.x86_64 1/1 Installed products updated. Installed: couchdb-3.1.1-1.el8.x86_64 Complete!
4. Configuring CouchDB
On this sub section, we will configure CouchDB on stand alone environment, where CouchDB can also be configured in clustered. Also we will configure CouchDB to be accessed via web browser and set the admin password for this new installed CouchDB. For this purpose we will update the configuration file which is located on : /opt/couchdb/etc/local.ini.
[ramans@otodiginet ~]$ sudo vi /opt/couchdb/etc/local.ini [chttpd] port = 5984 ;bind_address = 127.0.0.1 bind_address = 0.0.0.0 [admins] admin = mysecretpassword
5. Starting and Enabling CouchDB
After all parameters are set, the we will enable it and start its service. To start CouchDB service we just submit the following command line.
$ sudo systemctl enable couchdb $ sudo systemctl start couchdb $ sudo systemctl status couchdb
output process will be as shown below :
[ramans@otodiginet ~]$ sudo systemctl enable couchdb Created symlink /etc/systemd/system/multi-user.target.wants/couchdb.service → /usr/lib/systemd/system/couchdb.service. [ramans@otodiginet ~]$ sudo systemctl status couchdb ● couchdb.service - Apache CouchDB Loaded: loaded (/usr/lib/systemd/system/couchdb.service; enabled; vendor preset: disabl> Active: active (running) since Fri 2020-09-25 10:20:45 PDT; 13s ago Main PID: 4481 (beam.smp) Tasks: 40 (limit: 49614) Memory: 48.7M CGroup: /system.slice/couchdb.service ├─4481 /opt/couchdb/bin/../erts-9.3.3.14/bin/beam.smp -K true -A 16 -Bd -- -roo> ├─4499 /opt/couchdb/bin/../erts-9.3.3.14/bin/epmd -daemon └─4518 erl_child_setup 65536 Sep 25 10:20:45 bckinfo systemd[1]: Started Apache CouchDB.
6. Enabling Firewall
By default CouchDB is binding on port 5984, to make it accessible from any other clients we have to enable its firewall by submitting command line :
$ sudo firewall-cmd –zone=public –permanent –add-port=5984/tcp $ sudo firewall-cmd –reload
output will be as shown below :
[ramans@otodiginet ~]$ sudo firewall-cmd --zone=public --permanent --add-port=5984/tcp success [ramans@otodiginet ~]$ sudo firewall-cmd --reload success
7. Verifying CouchDB
To confirm that CouchDB is working as expected, use the curl command to print CouchDB’s information in JSON format. To verify if CouchDB is working normal, we will test it by using curl command line to query the CoucDB status.
$ curl http://192.168.59.128:5984/
Output is as shown below :
[ramans@otodiginet ~]$ curl http://192.168.59.128:5984/ {"couchdb":"Welcome","version":"3.1.1","git_sha":"ce596c65d","uuid":"7b3302ce32446079cad904f4bf12998a","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}


For any methods will be shown below :
[ramans@otodiginet ~]$ curl -u admin:mysecretpassword -X PUT http://otodiginet:5984/rapik_db {"ok":true} [ramans@otodiginet ~]$ curl -u admin:mysecretpassword -X GET http://otodiginet:5984/rapik_db {"db_name":"rapik_db","purge_seq":"0-g1AAAABXeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArkQGP2kSGpHqIoiwAtOgYRA","update_seq":"0-g1AAAABXeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArkQGP2kSGpHqIoiwAtOgYRA","sizes":{"file":16700,"external":0,"active":0},"props":{},"doc_del_count":0,"doc_count":0,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1},"instance_start_time":"0"}

ramans@otodiginet ~]$ curl -u admin:mysecretpassword -X PUT http://otodiginet:5984/testdelete_db {"ok":true} [ramans@otodiginet ~]$ curl -u admin:mysecretpassword -X GET http://otodiginet:5984/testdelete_db {"db_name":"testdelete_db","purge_seq":"0-g1AAAABXeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArkQGP2kSGpHqIoiwAtOgYRA","update_seq":"0-g1AAAABXeJzLYWBgYMpgTmEQTM4vTc5ISXIwNDLXMwBCwxyQVB4LkGRoAFL_gSArkQGP2kSGpHqIoiwAtOgYRA","sizes":{"file":16700,"external":0,"active":0},"props":{},"doc_del_count":0,"doc_count":0,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1},"instance_start_time":"0"} [ramans@otodiginet ~]$ curl -u admin:mysecretpassword -X DELETE http://otodiginet:5984/testdelete_db {"ok":true}

Conclusion
On this article we have shown you how to install CouchDB on CentOS 8 operating system.