How to Install Apache CouchDB on CentOS 7
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 a Vultr CentOS 7 server instance.
Prerequisites
- A VM running CentOS 7 (minimal install).
- A sudo user. You can read more about a sudo user in this Vultr article.
Step 1: Update the system
sudo yum install epel-releasesudo yum updatesudo 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-pipsudo pip install --upgrade pipsudo pip install -U Sphinx
Additionally, you need to compile Mozilla SpiderMonkey 1.8.5 from source:
cdwget http://ftp.mozilla.org/pub/js/js185-1.0.0.tar.gztar -xvf js185-1.0.0.tar.gzcd js-1.8.5/js/src/./configuremake && 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:
cdwget http://www-us.apache.org/dist/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gztar -xvf apache-couchdb-1.6.1.tar.gzcd 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 couchdbsudo 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/couchdbsudo chkconfig --add couchdbsudo 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 = 5984bind_address = 0.0.0.0
Save and quit:
:wq!
Modify firewall rules:
sudo firewall-cmd --permanent --zone=public --add-port=5984/tcpsudo 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.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article
Leave a Comment