-
-
Save anilbhanushali/244334b06805fd183ad3130d00036d3c to your computer and use it in GitHub Desktop.
Bash script that installs CouchDB on Amazon Linux EC2 (2015.09)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script is tuned to install CouchDB on an Amazon Linux (2015.09) EC2 Instance | |
#Documented here: | |
#https://cwiki.apache.org/confluence/display/COUCHDB/Amazon+Linux | |
#Install tools | |
sudo yum -y --enablerepo=epel groupinstall "Development Tools" | |
sudo yum -y --enablerepo=epel install perl-Test-Harness erlang-erts erlang-os_mon erlang-eunit libicu-devel autoconf-archive curl-devel erlang-etap erlang-asn1 erlang-xmerl js-devel | |
#Install CouchDB | |
wget http://mirror.ox.ac.uk/sites/rsync.apache.org/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz | |
tar zxvf apache-couchdb-1.6.1.tar.gz | |
cd apache-couchdb-1.6.1 | |
./configure --with-erlang=/usr/lib64/erlang/usr/include | |
make | |
sudo make install | |
#Update the CouchDB config to allow public access to management console | |
sudo sed -i -e 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/g' /usr/local/etc/couchdb/local.ini | |
#Create CouchDB user and set permissions | |
sudo adduser -r --home /usr/local/var/lib/couchdb -M --shell /bin/bash --comment "CouchDB Administrator" couchdb | |
sudo chown -R couchdb:couchdb /usr/local/etc/couchdb | |
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb | |
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb | |
sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb | |
sudo chown -R couchdb:couchdb /usr/local/lib/couchdb | |
sudo chmod 0770 /usr/local/etc/couchdb | |
sudo chmod 0770 /usr/local/var/lib/couchdb | |
sudo chmod 0770 /usr/local/var/log/couchdb | |
sudo chmod 0770 /usr/local/var/run/couchdb | |
#Update the init.d file (bug fix according to the document linked at the top) | |
sudo sed -i -e 's/if su $COUCHDB_USER -c "$command"; then/if sudo -i -u $COUCHDB_USER $command ; then/g' /usr/local/etc/rc.d/couchdb | |
#Create symbolic link | |
sudo ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb | |
#Start couchdb | |
sudo /etc/init.d/couchdb start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment