Skip to content

Instantly share code, notes, and snippets.

@morganney
Last active March 10, 2016 15:55
Show Gist options
  • Save morganney/8546761 to your computer and use it in GitHub Desktop.
Save morganney/8546761 to your computer and use it in GitHub Desktop.
Installing CouchDB 1.5 on EC2 CentOS (x86_64) Instance.
# Move to a location where you don't mind storing the couchdb install files.
cd /some/path/to/install/couchdb
# become root
su -
# Enable EPEL and REMI repositories for installing couchdb deps.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-6-8.noarch.rpm
# Install couchdb dependencies.
yum install "Development Tools" autoconf autoconf-archive automake libtool perl-Test-Harness erlang libicu-devel js-devel curl-devel
# Download and install couchdb.
wget http://mirror.reverse.net/pub/apache/couchdb/source/1.5.0/apache-couchdb-1.5.0.tar.gz
tar -xzf apache-couchdb-1.5.0.tar.gz
cd apache-couchdb-1.5.0.tar.gz
./configure --with-erlang=/usr/lib64/erlang/usr/include
make && make install
# Add couchdb user and proper file ownership and permissions.
adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb
chown -R couchdb:couchdb /usr/local/etc/couchdb
chown -R couchdb:couchdb /usr/local/var/lib/couchdb
chown -R couchdb:couchdb /usr/local/var/log/couchdb
chown -R couchdb:couchdb /usr/local/var/run/couchdb
chmod 0770 /usr/local/etc/couchdb
chmod 0770 /usr/local/var/lib/couchdb
chmod 0770 /usr/local/var/log/couchdb
chmod 0770 /usr/local/var/run/couchdb
# If you want to start couchdb as a daemon on boot.
ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
chkconfig --add couchdb
chkconfig --level 345 couchdb on
# In addition to the rule added for the ec2 security group, the centos firewall needs to
# allow traffic on couchdb's configured port. Edit the iptables config file and replace
# '5984' with whatever port your couchdb uses.
vi /etc/sysconfig/iptables
# Enter this right before the first REJECT rule. Replace '5984' as needed.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5984 -j ACCEPT
# Restart the iptables service
service iptables restart
# Allow couchdb to bind to your EC2 ip address
vi /usr/local/etc/couchdb/local.ini
[httpd]
;port = 5984
;bind_address = 127.0.0.1
bind_address = x.x.x.x # EC2 private IP address
# Start couchdb as a daemon
/usr/local/etc/rc.d/couchdb start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment