Saturday, July 15, 2017

Installing CouchDB on Red Hat Enterprise Linux

     I got this up and running on RHEL 7.3. It took awhile to get through all the dependencies. Unlike what it says on the CouchDB Installation page, there is no RPM for this. Your'e going to have to download, compile, punch things to get this installed. Hopefully this guide will help to expedite this and get your document database up and running.

1. Get the RPM dependencies that are actually available

sudo yum install autoconf autoconf-archive automake \
curl-devel libicu-devel libtool gcc-c++


2. Install the wxWidgets libraries 

wget http://downloads.naulinux.ru/pub/NauLinux/6x/x86_64/sites/School/RPMS//wxBase-2.8.12-1.el6.x86_64.rpm

yum install wxBase-2.8.12-1.el6.x86_64.rpm

wget https://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/wxGTK-2.8.12-1.el6.x86_64.rpm

yum install wxGTK-2.8.12-1.el6.x86_64.rpm

wget http://dl.fedoraproject.org/pub/epel/6/x86_64//wxGTK-gl-2.8.12-1.el6.x86_64.rpm

yum install wxGTK-gl-2.8.12-1.el6.x86_64.rpm

3. Install Erlang

wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_19.0~centos~6_amd64.rpm

yum install esl-erlang_19.0~centos~6_amd64.rpm

4. Install Mozilla SpiderMonkey 1.8.5

wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz

tar -xvf js185-1.0.0.tar.gz

cd js-1.8.5/js/src

./configure

make && make install

This is optional, its just where I personally chose to put these files

cd back to root dir where the js-1.8.5 folder is

move js-1.8.5 to /var/lib/js-1.8.5

cp -r js-1.8.5 /var/lib

5. Time to install CouchDB

wget http://apache.mirrors.ionfish.org/couchdb/source/2.0.0/apache-couchdb-2.0.0.tar.gz

tar -xzf apache-couchdb-2.0.0.tar.gz

cd apache-couchdb-2.0.0

./configure

Change the below line in ./apache-couchdb-2.0.0/src/couch/rebar.config.script to point to where you put the SpiderMonkey files. For this example I changed:

{"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/local/include/js"}, 

 to 

{"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/var/lib/js-1.8.5/js/src"},

Then make

make release

This is another optional step, it's just where I chose to put these files:

cp -r apache-couchdb-2.0.0/rel /var/lib/apache-couchdb-2.0.0/

Need to change the default.ini so we can access Fauxton from another server

vi /var/lib/apache-couchdb-2.0.0/rel/couchdb/etc/default.ini

Need to change bind_address under [chttpd] to 0.0.0.0

Now we can start up CouchDB

 nohup ./bin/couchdb/couchdb

If you want to make this run at start up add

/var/lib/apache-couchdb-2.0.0/rel/couchdb/bin/couchdb

to

/etc/rc.d/rc.local

6. Install the default databases

curl -X PUT http://127.0.0.1:5984/_users

curl -X PUT http://127.0.0.1:5984/_replicator

curl -X PUT http://127.0.0.1:5984/_global_changes


That should do it. You can then go to http:<servername>:5984/_utils to complete the configuration:

Figure 1. CouchDB Web UI

(Pro tip... If you are going to be using remote replication. I found the replication page in the web ui to not be working properly, best to use the REST API for this. Here is a good example of how to do this)

No comments:

Post a Comment