How to Install Apache CouchDB on CentOS 6 (from Source and EPEL)
2012-07-25 16:25
831 查看
How to Install Apache CouchDB on CentOS 6 (from Source and
EPEL)
by Ramesh Natarajanon June 13, 2012
Tweet
We are starting a new series on CouchDB. This the first
article in the CouchDB series.
CouchDB is an Apache project.
Just like the name suggest it is a database. CouchDB is a NoSQL database.
NoSQL databases doesn’t have any schema, tables, etc, that you’ll typically see
in a traditional databases like Oracle or MySQL. The data in CouchDB are stored
as JSON document, which you can access from a web browser using HTTP.
This article explains how to install CouchDB on RHEL based systems. For
example, CentOS, Red Hat, Oracle Enterprise Linux, etc.
There are two methods to install CouchDB. You can
install it from EPEL repository, or install from CouchDB source code.
Method 1: Install from EPEL
First, enable EPELrepository as we explained earlier.
Verify that the couchdb is available for yum install.
# yum info couchdb Name : couchdb Arch : x86_64 Version : 1.0.3 Release : 2.el6 Size : 1.7 M Repo : epel Summary : A document database server, accessible via a RESTful JSON API
Install couchdb. Depending on your system, this might install lot of
dependent packages. On my system, it installed 36 packages in total.
# yum install couchdb
Modify the local.ini file and add a line for bind_address and give the
ip-address the system where couchdb is installed.
# vi /etc/couchdb/local.ini [httpd] ;port = 5984 ;bind_address = 127.0.0.1 bind_address = 192.168.101.38
Start the couchdb services
# service couchdb start Starting couchdb: [ OK ] # service couchdb status couchdb (pid 29915) is running...
Verify that the couchdb works by going to the URL: http://{your-ip-address}:5984 , it should display a web-page that has the
following message.
{“couchdb”:”Welcome”,”version”:”1.0.3″}
Go to: http://{your-ip-address}:5984/_utils/ from where you can create and
manage the couchdb database.
Method 2: Install from CouchDB Source Code
If you like to install it yourself from the source code, first you shouldsatisfy all the dependencies.
Install the following standard packages from the CentOS repository.
# yum info gcc libtool xulrunner-devel libicu-devel openssl-devel
Install Erlang
Download the latest version of Erland from here. Or, you can use the wget asshown below to directly download it.
cd /usr/src wget http://www.erlang.org/download/otp_src_R15B01.tar.gz tar xvfz otp_src_R15B01.tar.gz
We’ll be installing couchdb and all its dependencies under /opt/couchdb
directory. So, while installing erlang, give the prefix as /opt/couchdb/erlang
as shown below.
cd otp_src_R15B01 ./configure --prefix=/opt/couchdb/erlang --without-termcap --without-javac --enable-smp-support --disable-hipe make make install
Install Curl
Download the latest version of Curl from here. Or, you can use the wget asshown below to directly download it.
cd /usr/src wget http://curl.haxx.se/download/curl-7.26.0.tar.gz tar xvfz curl-7.25.0.tar.gz
Just like Erlang, we’ll be installing Curl also under /opt/couchdb directory.
So, while installing curl, give the prefix as /opt/couchdb/curl as shown
below.
cd curl-7.25.0 ./configure --prefix=/opt/couchdb/curl make make install
SpiderMonkey JS Engine
Download the latest version of SpiderMonkey JS from here. Or, you can usethe wget as shown below to directly download it.
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
Please note that you have to cd to “js/src” subdirectory under js-1.8.5 to do
the ./configure and make as shown below to install spidermonkey js engine.
cd js-1.8.5/js/src ./configure make make install
You’ll see the libmozjs185.so.1.0.0 and libmozjs185-1.0.a installed under
/usr/local/lib
# ls -ltr /usr/local/lib -rwxr-xr-x. 1 root root 3671764 May 30 09:39 libmozjs185.so.1.0.0 -rwxr-xr-x. 1 root root 5523616 May 30 09:39 libmozjs185-1.0.a lrwxrwxrwx. 1 root root 35 May 30 09:40 libmozjs185.so.1.0 -> /usr/local/lib/libmozjs185.so.1.0.0 lrwxrwxrwx. 1 root root 33 May 30 09:40 libmozjs185.so -> /usr/local/lib/libmozjs185.so.1.0
Note: If spidermonkey JS library is not installed, you’ll get the following
error mesage while trying to do the ./configure mentioned in the next step.
checking for JS_NewObject in -lmozjs185... no configure: error: Could not find the js library. Is the Mozilla SpiderMonkey library installed?
Install CouchDB
Download the latest version of Couchdb from here. Or, you can use the wget as shownbelow to directly download it.
cd /usr/src wget http://apache.mirrors.pair.com/couchdb/releases/1.2.0/apache-couchdb-1.2.0.tar.gz tar xvfz apache-couchdb-1.2.0.tar.gz
While installing couchdb, you should set ERL, ERLC, CURL_CONFIG environment
variables as shown below. These are required during the ./config of couchdb.
Just like the prereqs, we’ll be installing couchdb under /opt/couchdb
directory. So, give the prefix as /opt/couchdb/couchdb as shown below.
cd apache-couchdb-1.2.0 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 ./configure --prefix=/opt/couchdb/couchdb --with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --enable-js-trunk make make install
Note: You’ll use the –enable-js-trunk only if you’ve installed the latest
version (anything newer than js185-1.0.0) of the SpiderMonkey JS engine. I
recommend that you use –enable-js-trunk option.
If you are not using the latest version of spidermonekey JS engine, you may
want to use the flags –with-js-include and –with-js-lib and point it to the
appropriate location as shown below.
./configure --prefix=/opt/couchdb/couchdb --with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --with-js-include=/usr/include/xulrunner-2/ --with-js-lib=/usr/lib64/xulrunner-devel-2/lib/
Note: If you’ve installed the latest version of spidermonkey js, and if you
are not using –enable-js-trunk, you’ll get the following error message during
“make” of couchdb:
cc1: warnings being treated as errors In file included from couch_js/main.c:20: couch_js/sm170.c: In function req_status: couch_js/sm170.c:105: error: implicit declaration of function INT_FITS_IN_JSVAL couch_js/sm170.c: In function evalcx: couch_js/sm170.c:138: error: implicit declaration of function JS_GetStringChars couch_js/sm170.c:138: error: assignment makes pointer from integer without a cast couch_js/sm170.c: In function seal: couch_js/sm170.c:220: error: implicit declaration of function JS_SealObject couch_js/sm170.c: At top level: couch_js/sm170.c:236: error: initialization from incompatible pointer type
Setup CouchDB Startup Services
Create a couchdb user that is required by the 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
Finally start the couchdb service.
# service couchdb start Starting database server couchdb
Verify that the couchdb works by going to the URL: http://{your-ip-address}:5984 , it should display a web-page that has the
following message.
{“couchdb”:”Welcome”,”version”:”1.0.3″}
Go to: http://{your-ip-address}:5984/_utils/ from where you can create and
manage the coucbdb database.
Next article in this series will explain how to create a CouchDB database and
perform some basic data manipulation.
http://www.thegeekstuff.com/2012/06/install-couch-db/
相关文章推荐
- How to Install and Configure Nginx from Source on centos--转
- How to Install Apache Kafka on CentOS 7
- How to Install Apache 2.4.2 from Source on CentOS 6.2 with SSL
- How to Install Apache OpenOffice on RHEL/CentOS
- How to install PostGIS 2.0 on Ubuntu 11.10 (oneiric) from source
- 【转】How to build and install PHP 5.6.9 from source on Ubuntu 14.04 VPS
- How To Install Apache Tomcat 7 on CentOS 7 via Yum
- how-to-install-ganglia-from-prebuild-rpm-on-centos6.6-x86_64
- How to Install LAMP (Apache 2.4, MySQL 5.6, and PHP 5.4) on CentOS/RHEL 7
- How to install SVN server with USVN, Apache, mod_dav_svn on CentOS 6
- How to install Apache, PHP 7.1 and MySQL on CentOS 7.3 (LAMP)
- How to Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6
- How to Install Linux, Apache, MySQL, PHP (LAMP) stack on CentOS 6 【Reliable】
- How to Install PHP 7 with Apache and MariaDB on CentOS 7/Debian 8
- How to install Apache Server on CentOS RedHat Linux, How to configure Apacahe Server on CentOS RedHat Linux | Antoine Solutions Development
- How to Install RSyslog+MySQL with LogAnalyzer on CentOS
- How to install Python 2.7 and Python 3.3 on CentOS 6
- How To Install Git on CentOS 7
- How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 16.04
- How to install Wordpress 4.0 on CentOS 7.0