Skip to content

Instantly share code, notes, and snippets.

@mshuler
Last active August 29, 2015 14:07
Show Gist options
  • Save mshuler/77041586f6a98e31fbbb to your computer and use it in GitHub Desktop.
Save mshuler/77041586f6a98e31fbbb to your computer and use it in GitHub Desktop.
Configure an Ubuntu Trusty 14.04 server for Cassandra and Driver build/test environment
#!/bin/sh
if [ $(id -ru) -ne 0 ]; then
echo "$0 must be run as root or with sudo"
exit 1
fi
RELEASE=$( lsb_release --short --codename )
CHECK="true"
if [ "$CHECK" = "true" ]; then
if [ "$RELEASE" = "trusty" ]; then
echo "Found Ubuntu Trusty 14.04 - setting up for Cassandra and driver build/test.."
else
# we can build up other OS flavor profiles, but for now warn and exit..
echo "This should work on Ubuntu Trusty 14.04 - set CHECK=\"false\" to ignore OS check.."
exit 1
fi
fi
# already have java installed and in $PATH?
if java -version; then
echo
echo "Using your installed java version above.."
echo
else
echo
echo "Installing Oracle JDK via ppa:webupd8team/java.."
echo
# the webupd8 package does not have full Provides:, so OpenJDK may still get installed with the
# additional packages later, but Oracle should have a higher alternatives priority
if add-apt-repository -y ppa:webupd8team/java; then
apt-get update
echo "debconf shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
echo "debconf shared/accepted-oracle-license-v1-1 seen true" | debconf-set-selections
apt-get -y install oracle-java7-installer
else
echo "Cannot set up ppa:webupd8team/java, so we have other problems.. sorry it didn't work out."
exit 1
fi
fi
echo
echo "Installing some basics.."
echo
apt-get update -q2 # in case we already had java installed..
apt-get -Vy install bash-completion build-essential devscripts git htop screen vim
echo
echo "Installing Cassandra and Driver build/test deps.."
echo
apt-get -Vy install ant ant-optional cmake iamerican libasio-dev \
libboost-program-options-dev libboost-system-dev libboost-test-dev \
libboost-thread-dev libev-dev libjna-java libssh2-1-dev libuv-dev \
libyaml-dev python-blist python-boto python-concurrent.futures \
python-decorator python-dev python-nose python-pexpect python-psutil \
python-pygments python-setuptools python-six python-sphinx python-thrift \
python-tox python-virtualenv python-yaml
# install these without recommended packages - the huge extra list is not needed
apt-get -Vy --no-install-recommends install doxygen ivy libmaven-bundle-plugin-java maven
wget https://dl.bintray.com/sbt/debian/sbt-0.13.6.deb
dpkg -i ./sbt-*.deb
cat << 'EOF'
Git repository links:
git clone https://github.com/apache/cassandra.git
git clone https://github.com/pcmanus/ccm.git
git clone https://github.com/mshuler/cassandra-dbapi2.git
git clone https://github.com/pycassa/pycassa.git
git clone https://github.com/riptano/cassandra-dtest.git
git clone https://github.com/datastax/cpp-driver.git
git clone https://github.com/datastax/csharp-driver.git
git clone https://github.com/datastax/java-driver.git
git clone https://github.com/datastax/python-driver.git
git clone https://github.com/datastax/spark-cassandra-connector.git
Handy commands or ~/.profile additions:
export GITDIR=$HOME/git
mkdir $GITDIR
# clone needed repos and update PATH/PYTHONPATH as needed, ie:
export PATH="$PATH:$GITDIR/cassandra/bin:$GITDIR/cassandra/tools/bin:$GITDIR/ccm"
export PYTHONPATH="$PYTHONPATH:$GITDIR/cassandra/pylib:$GITDIR/ccm:$GITDIR/python-driver:$GITDIR/cassandra-dbapi2:$GITDIR/pycassa"
Done.
EOF
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment