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.
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:
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.
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:
How to Access CouchDB using a browser ?
Finally, to log in to your instance, browse the URL below:
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. ]