CentOS5 に Apache CouchDB をインストールした。



<pre class='prettyprint'>■ ビルドする
$ wget http://ftp.riken.jp/net/apache/couchdb/0.9.1/apache-couchdb-0.9.1.tar.gz
$ tar zxvf apache-couchdb-0.9.1.tar.gz
$ cd apache-couchdb-0.9.1
$ ./configure
$ make
$ sudo make install

■ RPM としてインストールする
$ sudo checkinstall
(snip)
This package will be built according to these values:

1 - Summary: [ CouchDB ]
2 - Name: [ apache-couchdb ]
3 - Version: [ 0.9.1 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ apache-couchdb-0.9.1 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ apache-couchdb ]
(snip)
$ sudo rpm -i /usr/src/redhat/RPMS/i386/apache-couchdb-0.9.1-1.i386.rpm

■ service, chkconfig コマンドから開始、停止できるようにする
$ ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
$ adduser couchdb
$ sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
$ sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
$ sudo /sbin/chkconfig –add couchdb

■ 他のクライアントPCのブラウザから見えるようにする - セキュリティに気をつかう環境の場合は注意!
$ sudo vi /usr/local/etc/couchdb/default.ini
[httpd]
port = 5984
bind_address = 0.0.0.0 ← 127.0.0.1 から 0.0.0.0 に書き換えた

$ sudo vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5984 -j ACCEPT ← 追加した
$ sudo /sbin/service iptables restart
</pre>



<h3>動作確認</h3>

<pre class='prettyprint'>$ sudo /sbin/service couchdb start
Starting database server couchdb

$ curl http://localhost:5984/
{“couchdb”:”Welcome”,”version”:”0.9.1”}
</pre>



<h3>configure中のエラーとその対処</h3>

<pre class='prettyprint'>$ ./configure
(snip)
checking whether to build static libraries… no
checking whether ln -s works… yes
checking for pthread_create in -lpthread… yes
checking for JS_NewContext in -ljs… no
checking for JS_NewContext in -lmozjs… no
configure: error: Could not find the js library.

Is the Mozilla SpiderMonkey library installed?

$ sudo yum install js-devel
(snip)
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
js-devel i386 1.60-1.el5.rf rpmforge 531 k
Installing for dependencies:
js i386 1.60-1.el5.rf rpmforge 1.0 M

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 1.6 M
</pre>

<pre class='prettyprint'>$ ./configure
(snip)
checking for JS_NewContext in -ljs… yes
checking jsapi.h usability… yes
checking jsapi.h presence… yes
checking for jsapi.h… yes
checking for icu-config… no
* The icu-config script could not be found. Make sure it is
* in your path, and that taglib is properly installed.
* Or see http://ibm.com/software/globalization/icu/
configure: error: Library requirements (ICU) not met.

$ sudo yum install libicu-devel
(snip)
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
libicu-devel i386 3.6-5.11.4 updates 571 k
Installing for dependencies:
libicu i386 3.6-5.11.4 updates 5.2 M

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 5.8 M
</pre>

<pre class='prettyprint'>$ ./configure
(snip)
checking ICU_LIBS… -licui18n -licuuc -licudata -lpthread -lm
checking for curl-config… no
* The curl-config script could not be found. Make sure it is
* in your path, and that curl is properly installed.
* Or see http://curl.haxx.se/
configure: error: Library requirements (curl) not met.

$ sudo yum install curl-devel
(snip)
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
curl-devel i386 7.15.5-2.1.el5_3.5 updates 307 k
Installing for dependencies:
libidn-devel i386 0.6.5-1.1 base 239 k

Transaction Summary
================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 545 k
</pre>