Apache
CouchDB is a database that completely embraces the web. Store
your data with JSON documents. Access your documents with your web browser, via
HTTP. Query, combine, and transform your documents with JavaScript. CouchDB
works well with modern web and mobile apps.
Click here for details.
To install CouchDB,
we need to have required collections of packages installed on our systems that
CouchDB depends on.
Gcc-4.4.7
libicu-devel-4.2.1
libicu-devel-4.2.1
libtool-2.2.6
openssl-devel-1.0.0
xulrunner-devel-
17.0.10
gcc-c++-4.4.7
Erlang:
otp_src_R16B02.tar.gz (build from source)
curl-7.26.0
SpiderMonkey
JS : js185-1.0.0
|
EPEL Repository:
Enable EPEL Repository on RHEL for
Yum Package Management
What is EPEL?
Extra Packages for Enterprise Linux (or EPEL) is a Fedora
Special Interest Group that creates, maintains, and manages a high quality set
of additional packages for Enterprise Linux.
Click here for more details
Install EPEL repository:
#Update
the yum
yum
update -y
|
# Run the below command to find the epel package is already installed or not
yum
repolist
|
# Download the epel-release-6-8.noarch rpm
cd /tmp/
|
# Test epel-release-6-8.noarch.rpm
for the KEY
cd /tmp/
rpm -ivh
epel-release-6-8.noarch.rpm –test
# This
will give NOKEY found warning message.
|
#
Download the key ID 0608b895: NOKEY
cd /tmp/
wget
https://fedoraproject.org/static/0608B895.txt --no-check-certificate
mv
/tmp/0608B895.txt /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm
--import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
|
# Verify the KEY success installation
rpm -qa
gpg*
|
#
Install epel-release-6-8
cd /tmp/
rpm -ivh
epel-release-6-8.noarch.rpm
|
# Verify
EPEL – epel package
yum
repolist
|
Apache
Couch DB 1.4.0:
Install the following standard
packages from the repository
#
Install Development Tools & Development Libraries packages
yum
install gcc libtool xulrunner-devel libicu-devel openssl-devel make which
gcc-c++
|
Install
Erlang:
#
Download the Erlang source files
cd
/usr/src
wget http://www.erlang.org/download/otp_src_R16B02.tar.gz
tar xvfz
otp_src_R16B02.tar.gz
|
#
Install Erlang from source
cd
/usr/src/otp_src_R16B02
./configure
--prefix=/opt/couchdb/erlang --without-termcap --without-javac
--enable-smp-support --disable-hipe
sudo
make
sudo
make install
|
# Verify the Erlang installation
cd
/usr/src/otp_src_R16B02
./bin/erl
# Output
Erlang
(BEAM) emulator version x.x.x [threads]
Eshell Vx.x.x (abort with ^G)
1>
|
Install
Curl:
#
Download Curl
cd
/usr/src
wget http://curl.haxx.se/download/curl-7.26.0.tar.gz
tar xvfz
curl-7.26.0.tar.gz
|
#
Install Curl
cd
/usr/src/curl-7.26.0
./configure
--prefix=/opt/couchdb/curl
sudo
make
sudo
make install
|
Install
SpiderMonkey JS Engine:
#
Download SpiderMonkey JS Engine js185-1
cd
/usr/src
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xvfz
js185-1.0.0.tar.gz
|
#
Install SpiderMonkey JS Engine
cd
js-1.8.5/js/src
./configure
sudo
make
sudo
make install
|
#Verify
SpiderMonkey JS engine
ls -ltr
/usr/local/lib
# Output
# You’ll see the libmozjs185.so.1.0.0 and
libmozjs185-1.0.a installed under /usr/local/lib
|
Install
Apache CouchDB 1.4.0:
#
Download CouchDB 1.4.0
cd
/usr/src
wget http://www.us.apache.org/dist/couchdb/source/1.4.0/apache-couchdb-1.4.0.tar.gz
tar xvfz
apache-couchdb-1.4.0.tar.gz
|
#
Install CouchDB
cd
/usr/src/apache-couchdb-1.4.0
export
LD_LIBRARY_PATH=/usr/local/lib
export
ERL=/opt/couchdb/erlang/bin/erl
export
ERLC=/opt/couchdb/erlang/bin/erlc
export
CURL_CONFIG=/opt/couchdb/curl/bin/curl-config
export
LDFLAGS=-L/opt/couchdb/curl/lib
# Use
below configure if SpiderMonkey version is 1.8.5 or greater
./configure
--prefix=/opt/couchdb/couchdb
--with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --enable-js-trunk
# Use below configure if SpiderMonkey version is less than 1.8.5 (Recommended)
./configure
--prefix=/opt/couchdb/couchdb
--with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/
--with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/
sudo
make
sudo
make install
|
# Create a couchdb user for CouchDB startup program
adduser
couchdb
|
# Change
the ownership of the var directory, where couchdb will write logs and some
other information.
chown -R
couchdb /opt/couchdb/couchdb/var/
|
# Create
a link under /etc/init.d for couchdb service
ln -s
/opt/couchdb/couchdb/etc/rc.d/couchdb /etc/init.d/couchdb
|
# Start
the couchdb service.
sudo service
couchdb start
|
# Verify
the CouchDB installation
curl
localhost:5984
|
#Access
Futon through SSH tunnel
#Couchdb
also offers a convenient visual representation of the database called Futon.
In order securely connect to it, without making it publicly available, you
can create an SSH tunnel from your local port 5984 to the remote server's
port 5984.
#You can
use the following command, run from your local computer, to set up the
tunnel:
ssh
-L5984:127.0.0.1:5984 [user]@[your_ip_address]
|
* Thanks to Ramesh
Natarajan TheGeekStuff for his blog that helped me a lot in CouchDB installation process.