Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tisba
Created July 30, 2010 18:15
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tisba/501039 to your computer and use it in GitHub Desktop.
Save tisba/501039 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# where do you want couchdb and its deps to be installed
COUCHDB_PREFIX="/opt/couchdb-1.0.1"
# Let's determine the correct arcitecture and choose the installer
if [ "`uname -m`" = "x86_64" ]; then
echo "Using 64-bit installer"
COUCHDB_INSTALLER_DOC_ID="26f246a0fe23d6a53d5326713308f43c"
COUCHDB_INSTALLER_BIN="install-couchdb-1.0.1_rel1-linux-x64.bin"
else
echo "Using 32-bit installer"
COUCHDB_INSTALLER_DOC_ID="26f246a0fe23d6a53d53267133090142"
COUCHDB_INSTALLER_BIN="install-couchdb-1.0.1_rel1-linux.bin"
fi
COUCHDB_INSTALLER_URL="http://dl.couchone.com/dl/$COUCHDB_INSTALLER_DOC_ID/$COUCHDB_INSTALLER_BIN"
echo "Downloading and verifying installer"
curl $COUCHDB_INSTALLER_URL -O --silent
curl "http://dl.couchone.com/dl/_design/dl/_show/sha1/$COUCHDB_INSTALLER_DOC_ID" --silent | sha1sum --status --check -
if [ "$?" -ne "0" ]; then
echo "Download verification failed"
exit 1
fi
echo "Running the installer"
chmod u+x $COUCHDB_INSTALLER_BIN && sudo ./$COUCHDB_INSTALLER_BIN --prefix $COUCHDB_PREFIX --mode unattended
if [ "$?" -ne "0" ]; then
echo "Installer problem"
echo "Downloaded the installer from: $COUCHDB_INSTALLER_URL"
exit 1
fi
# link into /etc/init.d/couchdb and setup couchdb for auto-startup
sudo ln -s $COUCHDB_PREFIX/etc/init.d/couchdb /etc/init.d/couchdb
sudo ln -s $COUCHDB_PREFIX/etc/default/couchdb /etc/default/couchdb
sudo update-rc.d couchdb defaults
# prepare system
sudo adduser --system \
--home $COUCHDB_PREFIX/var/lib/couchdb \
--no-create-home \
--shell /bin/bash \
--group --gecos \
"CouchDB Administrator" couchdb
# ensure that our new user owns it's stuff
sudo chown -R couchdb:couchdb $COUCHDB_PREFIX/{etc,var/lib,var/run,var/log}/couchdb
sudo /etc/init.d/couchdb restart
echo "Done!"
@jhs
Copy link

jhs commented Aug 28, 2010

In line 27, I think you need && sudo instead of just &&

@tisba
Copy link
Author

tisba commented Aug 28, 2010

you are right, fixed and thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment