How To Install CouchDB on AlmaLinux 8

In this article, we want to teach you How To Install CouchDB on AlmaLinux 8.

Apache CouchDB is a non-relational or NoSQL database that was developed to fully embrace the web. Data is stored within JSON documents which can be accessed and its indices queried via HTTP.

How To Install CouchDB on AlmaLinux 8

To set up CouchDB on AlmaLinux 8, you need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our article about the Initial Server Setup with AlmaLinux 8.

Now you can follow the steps below to install Apache CouchDB on AlmaLinux 8.

Set up CouchDB on AlmaLinux 8

First, you need to update your local package index with the following command:

sudo dnf update

Then, you need to install the yum-utils on your AlmaLinux 8:

sudo yum install -y yum-utils

Now you can enable the CouchDB repository on your server with the following command:

sudo yum-config-manager --add-repo https://couchdb.apache.org/repo/couchdb.repo

Update your local package index again with the command below:

sudo dnf update

You will be asked to add the GPG key, and press y to continue.

Next, use the following command to install CouchDB:

sudo dnf install -y couchdb

Now start and enable your CouchDB on your AlmaLinux 8 with the following command:

$ sudo systemctl start couchdb
$ sudo systemctl enable couchdb

Verify that your service is active and running on your server with the following command:

sudo systemctl status couchdb

In your output you will see:

Output
couchdb.service - Apache CouchDB
Loaded: loaded (/usr/lib/systemd/system/couchdb.service; enabled; vendor pre>
Active: active (running) since Wed 2021-12-01 05:17:57 EST; 3s ago
Main PID: 89031 (beam.smp)
Tasks: 36 (limit: 11409)
Memory: 29.8M
CGroup: /system.slice/couchdb.service
├─89031 /opt/couchdb/bin/../erts-9.3.3.15/bin/beam.smp -K true -A 16>
├─89044 /opt/couchdb/bin/../erts-9.3.3.15/bin/epmd -daemon
└─89063 erl_child_setup 65536

Now that you have CouchDB installed on your server, you need to make some configuration changes.

Configure CouchDB on AlmaLinux 8

At this point, we will configure CouchDB in a Standalone (single mode configuration) mode.

Open the CouchDB configuration file with your favorite text editor, here we use vi:

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

At the file, in the [chttpd] section, uncomment the port and bind address. The default value for standalone mode is 127.0.0.1. You can change it to 0.0.0.0 which listens to all interfaces. Or, you can change it to a specific IP address.

[chttpd]
port = 5984
bind_address = 0.0.0.0

Also, you need to create an admin user. In the [admins] section set the password for your admin user:

[admins]
admin = mypassword

When you are done, save and close the file.

To apply the changes restart the CouchDB service on AlmaLinux 8 with the following command:

sudo systemctl restart couchdb

We assumed that you have enabled firewalld from the requirements.

At this point, you need to open port 5984 port to allow traffic CouchDB on AlmaLinux 8. To do this, run the following command:

sudo firewall-cmd --zone=public --permanent --add-port=5984/tcp

Now reload the firewall with the command below to apply the new rules:

sudo firewall-cmd --reload

Here you can use the curl command to confirm that CouchDB is working correctly:

curl http://127.0.0.1:5984/

In your output you will see:

Output
{"couchdb":"Welcome",
"version":"3.2.1",
"git_sha":"244d428af",
"uuid":"da322c2d8f6d3e3971c4ee266ff25e9f",
"features":["access-ready","partitioned",
"pluggable-storage-engines","reshard","scheduler"],
"vendor":{"name":"The Apache Software Foundation"}}

Or from your web browser you can type your server IP address to access the CouchDB web interface:

http://server-ip:5984/_utils/

You will see:

CouchDB login credentials

You should enter your admin user and the password that you have defined before and you will get into the Apache CouchDB interface:

CouchDB interface with AlmaLinux 8

Conclusion

At this point, you learn to set up and configure CouchDB on AlmaLinux 8.

Hope you enjoy using it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!