Learn How To Install Apache CouchDB on CentOS 7

September 29, 2019

Table of Contents

Apache CouchDB is an open source NoSQL database management system that uses JSON for data storage, JavaScript for MapReduce indexes, and regular HTTP for its API. You can access and manage Apache CouchDB from a web browser via HTTP or API, and Apache CouchDB works well with all modern web browsers and mobile apps.

This article will explain how to install Apache CouchDB on An ITWeb.Services CentOS 7 server instance.

Prerequisites

  • A VM running CentOS 7 (minimal install).
  • https://www.itweb.services/tutorials/linux-guides/how-to-use-sudo-on-debian-centos-and-freebsd”>IT Web Services article.

Step 1: Update the system

sudo yum install epel-release
sudo yum update
sudo shutdown -r now

After the system reboot, use the same sudo user to log in.

Step 2: Install dependencies

At the time of writing, you need to install the following dependencies before you can install Apache CouchDB 1.6.1:

  • Erlang OTP (>=R14B01, =<R17)
  • ICU
  • OpenSSL
  • Mozilla SpiderMonkey (1.8.5)
  • GNU Make
  • GNU Compiler Collection
  • libcurl
  • help2man
  • Python (>=2.7) for docs
  • Python Sphinx (>=1.1.3)

On CentOS 7, you can use the command below to install dependencies other than Sphinx and Mozilla SpiderMoney:

sudo yum install autoconf autoconf-archive automake curl-devel erlang gcc-c++ help2man js-devel libicu-devel libtool perl-Test-Harness unzip zip wget

Next, install Sphinx using pip:

sudo yum install -y python-devel python-setuptools python-pip
sudo pip install --upgrade pip
sudo pip install -U Sphinx

Additionally, you need to compile Mozilla SpiderMonkey 1.8.5 from source:

cd
wget http://ftp.mozilla.org/pub/js/js185-1.0.0.tar.gz
tar -xvf js185-1.0.0.tar.gz
cd js-1.8.5/js/src/
./configure
make && sudo make install

Step 4: Install and configure Apache CouchDB

At the time of writing, Apache CouchDB needs to be compiled from source as well:

cd
wget http://www-us.apache.org/dist/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
tar -xvf apache-couchdb-1.6.1.tar.gz
cd apache-couchdb-1.6.1
./configure --with-erlang=/usr/lib64/erlang/usr/include/
make && sudo make install

For security purposes, you need to configure Apache CouchDB as below:

sudo useradd --no-create-home couchdb
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb /usr/local/var/log/couchdb /usr/local/var/run/couchdb

Make Apache CouchDB run after the system gets started:

sudo ln -sf /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
sudo chkconfig --add couchdb
sudo chkconfig couchdb on

Allow access from web:

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

Find the two line below within the [httpd] section:

;port = 5984
;bind_address = 127.0.0.1

Replace them with:

port = 5984
bind_address = 0.0.0.0

Save and quit:

:wq!

Modify firewall rules:

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

Now, it’s time to get Apache CouchDB started:

sudo /etc/init.d/couchdb start

Step 5: Access Apache CouchDB from a web browser

Use a web browser to visit the following URL:

http://<your-server-ip-address>:5984/_utils/

If all of the steps above are successful, you will step into the Apache CouchDB admin panel.

Finally, click the “Fix this” link at the bottom-right-hand corner to setup an admin user account and its password.

This concludes our tutorial. Thank you for reading.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!