Differences between revisions 19 and 20
Revision 19 as of 2013-03-11 22:59:51
Size: 5773
Editor: chello084112019176
Comment: 1st time on aws linux
Revision 20 as of 2018-12-17 18:21:51
Size: 0
Editor: JoanTouzet
Comment: See http://docs.couchdb.org/en/stable/install/index.html
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(EditTheWiki)>>

= Installing on RHEL 5 =
These instructions also work on Red Hat Enterprise Linux compatible distributions like CentOS.

Note: [[https://issues.apache.org/jira/browse/COUCHDB-315|COUCHDB-315]] has an attached patch for the CouchDB README which adds instructions for RHEL 5.

== Installing a prepackaged CouchDB ==
1. Enable the [[http://fedoraproject.org/wiki/EPEL|EPEL]] repository.

2. Install the couchdb package from EPEL:

{{{
# yum install couchdb
}}}
3. Edit config file to suit:

{{{
# vi /etc/couchdb/local.ini
}}}
4. Start CouchDB:

{{{
# service couchdb start
}}}
5. Set it to start automatically on reboots:

{{{
# chkconfig --level 345 couchdb on
}}}
== Building CouchDB from source (with EPEL packages) ==
1. Install prerequisites. You will need to enable the [[http://fedoraproject.org/wiki/EPEL|EPEL]] repository for the js-devel and erlang packages (or build js and erlang from source). On AWS Linux, edit {{{/etc/yum.repos.d/epel.repo}}} and inside the {{{[epel]}}} segment, change {{{enabled=1}}}.

{{{
# yum install libicu-devel openssl-devel curl-devel make gcc erlang js-devel libtool which
}}}
1.1 If installing CouchDB >= 0.11, you will need cURL>= 7.18. Currently neither [[http://fedoraproject.org/wiki/EPEL|EPEL]], nor [[http://iuscommunity.org/|IUS]] provide a current enough [[http://curl.haxx.se/libcurl/|libcurl]]. Visit the curl [[http://curl.haxx.se/download.html|download page]] for the most recent curl package.

{{{
$ wget http://curl.haxx.se/download/curl-7.20.1.tar.gz
$ tar -xzf curl-7.20.1.tar.gz
$ cd curl-7.20.1
$ ./configure --prefix=/usr/local
$ make
$ make test
# make install
}}}
2. Install CouchDB

The configure line below is for 64-bit, adjust for your arch (or leave out --with-erlang if configure can find out for itself). You can use a release tarball instead of a checkout, in that case skip right to the ./confgure line.

{{{
$ svn checkout http://svn.apache.org/repos/asf/couchdb/trunk couchdb
$ cd couchdb
$ ./bootstrap
$ ./configure --with-erlang=/usr/lib64/erlang/usr/include
$ make
# make install
}}}
3. Edit config file to suit

{{{
# vi /usr/local/etc/couchdb/local.ini
}}}
4. Create user, modify ownership and permissions

Create the couchdb user:

{{{
# adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb
}}}
See the README for additional chown and chmod commands to run.

4.1 fix permission
{{{
chown -R couchdb: /usr/local/var/lib/couchdb /usr/local/var/log/couchdb
}}}

5. Launch!

{{{
# sudo -u couchdb couchdb
}}}
Or as daemon:

{{{
# /usr/local/etc/rc.d/couchdb start
}}}
6. Run as daemon on start-up:

{{{
# ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
# chkconfig --add couchdb
# chkconfig --level 345 couchdb on
}}}

== Building CouchDB from source (with standard packages only) ==

Tested with 64-bit CentOS 5.6. Replace "/opt/couchdb" with a directory of your choice.

1. Install prerequisites (standard packages only, no additional repositories).
{{{
# yum install gcc libtool xulrunner-devel libicu-devel openssl-devel
}}}

2. Build Erlang from otp_src_R14B.tar.gz:
{{{
$ ./configure --prefix=/opt/couchdb/erlang --without-termcap --without-javac --enable-smp-support --disable-hipe
$ make
# make install
}}}

3. Build Curl from curl-7.21.6.tar.gz:
{{{
$ ./configure --prefix=/opt/couchdb/curl
$ make
# make install
}}}

4. Build CouchDB from apache-couchdb-1.0.2.tar.gz
{{{
$ ERL=/opt/couchdb/erlang/bin/erl ERLC=/opt/couchdb/erlang/bin/erlc CURL_CONFIG=/opt/couchdb/curl/bin/curl-config LDFLAGS=-L/opt/couchdb/curl/lib ./configure --prefix=/opt/couchdb/couchdb --with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --with-js-include=/usr/include/xulrunner-sdk-1.9.2/ --with-js-lib=/usr/lib64/xulrunner-sdk-1.9.2/lib
$ make
# make install
}}}
== Tip: mind the firewall ==
It's very likely that the default installation of a Red Hat system has the firewall turned on. This can be verified by issuing:
{{{
# service iptables status
}}}
If it is active then it will list the rules, otherwise you'll get an ''unrecognized service'' error message.
The default firewall configuration on such system resides in /etc/sysconfig/iptables (and if you're using ipv6 then /etc/sysconfig/ip6tables).
In this case just insert a rule for CouchDB before the REJECT rule. By default, the rules should look like the following (already added the CouchDB rule):
{{{
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
### The following rule allows CouchDB connections from everywhere ###
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 5984 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
}}}

Similarly, the firewall could be active also on CentOS systems. The file is still the same (/etc/sysconfig/iptables) but the default rules change a bit.
Also in this case insert the rule for CouchDB before the REJECT.
{{{
-A INPUT -p tcp --dport 5984 -j ACCEPT
}}}

In both cases, don't forget to restart the iptables service
{{{
# service iptables restart
}}}