Installation Couchdb - kwantu/platformconfiguration GitHub Wiki
Core couchdb installation
See the official documentation here
- Enable the Apache CouchDB package repository
In CentOS open the following yum package repository
#
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://couchdb.apache.org/repo/couchdb.repo
Place the following text into the repo
[bintray--apache-couchdb-rpm]
name=bintray--apache-couchdb-rpm
baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/
gpgcheck=0
repo_gpgcheck=0
enabled=1
- Install the Apache CouchDB packages
In RedHat/CentOS run the command:
$ sudo yum -y install epel-release && yum install couchdb
Upgrade to Couchdb 3.3.1 issues
The update will update couchdb, make sure that the vm.args and local.ini are up to date.
- Update couchdb with the rest of the server
sudo yum install erlang-reltool
sudo yum clean all
sudo yum -y install epel-release
sudo yum -y update
# if new kernel installed be sure it reboots
reboot now
- Couchdb 3.3.1 requires erlang 20 - 24, but centos by default only installs 16. Before updating we need to remove the old erlang, manually download the rpm from Erlang website, and then install couchdb.
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
rpm -Uvh erlang-solutions-1.0-1.noarch.rpm
yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git wget wxBase.x86_64
# now get the latest erlang package - we use 24 because clouseau needs it
wget https://packages.erlang-solutions.com/erlang/rpm/centos/7/x86_64/esl-erlang_24.3.4.1-1~centos~7_amd64.rpm
rpm -i esl-erlang_24.3.4.1-1~centos~7_amd64.rpm
# If you get conflicts manually remove erlang 16
yum erase erlang-erts-R16B-03.18.el7.x86_64
# then install erlang again
rpm -i esl-erlang_24.3.4.1-1~centos~7_amd64.rpm
# in one case libodbc.so.2 needed, fix with
#error: Failed dependencies:
# libodbc.so.2()(64bit) is needed by esl-erlang-24.3.4.1-1.x86_64
yum install unixODBC
================================ This is deprecated
Install runit service manager
- Download runit repo for centos (Make sure you download for the correct operating system)
mkdir /root/work
curl -s https://packagecloud.io/install/repositories/imeyer/runit/script.rpm.sh > /root/work/runit.rpm.sh
chmod 755 /root/work/runit.rpm.sh
/root/work/runit.rpm.sh
yum install runit
However, that seems to fail for RedHat. Therefore followed this approach:
- Download the rpm file from https://packagecloud.io/imeyer/runit/packages/el/7/runit-2.1.2-3.el7.centos.x86_64.rpm
- Then install this with the rpm package manager
rpm -i runit-2.1.2-3.el7.centos.x86_64.rpm
#test that it was installed
sv
#responds as
usage: sv [-v] [-w sec] command service ...
- Create couchdb service directories
mkdir /etc/sv/
mkdir /etc/sv/couchdb
mkdir /etc/sv/couchdb/log
mkdir /etc/sv/couchdb/log/supervise
mkdir /etc/sv/couchdb/control
mkdir /etc/sv/couchdb/supervise
#make sure owned by root
chown -R root:root /etc/sv
#then set the correct file permissions
chmod -R 0755 /etc/sv
chmod -R 0755 /etc/sv
chmod 0700 /etc/sv/couchdb/supervise
chmod 0700 /etc/sv/couchdb/log/supervise
- Install the logging service
vim /etc/sv/couchdb/log/run
#--------insert this----------
#!/bin/sh
exec svlogd -tt /var/log/couchdb
- Install the couchdb service
vim /etc/sv/couchdb/run
#--------insert this----------
#!/bin/sh
ulimit -n 246000
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
export ERL_MAX_PORTS=246000
export HOME=/opt/couchdb
exec 2>&1
exec chpst -u couchdb ${HOME}/bin/couchdb
- Create a symlink to enable boot persistant and start
ln -s /etc/sv/couchdb /etc/service/couchdb