Skip to content

Instantly share code, notes, and snippets.

@nfaggian
Last active August 29, 2015 13:57
Show Gist options
  • Save nfaggian/9721691 to your computer and use it in GitHub Desktop.
Save nfaggian/9721691 to your computer and use it in GitHub Desktop.
Map reduce environment
#! /usr/bin/env bash
REPOSITORY="http://repo.continuum.io/miniconda"
if [ "$(uname)" == "Darwin" ]; then
PACKAGE="Miniconda3-3.3.0-MacOSX-x86_64.sh"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
PACKAGE="Miniconda3-3.3.0-Linux-x86_64.sh"
sed -i .bashrc -e '6s/\[/\#\[/1'
fi
PTYHON_DISTRIBUTION=${HOME}/work/anaconda
################################################################################
# Retrieve and install the python distribution
################################################################################
pushd /tmp/
wget -nc ${REPOSITORY}/${PACKAGE}
mkdir -p ~/work/
/usr/bin/env bash /tmp/${PACKAGE} -b -p ${PTYHON_DISTRIBUTION}
popd
# Install a set of appropriate python libraries.
DEPENDENCIES=( pip
numpy
scipy
matplotlib
ipython
scikit-learn
scikit-image
pandas
requests
h5py )
${HOME}/work/anaconda/bin/conda install --yes ${DEPENDENCIES[@]}
export PATH=${PTYHON_DISTRIBUTION}/bin:$PATH
################################################################################
# Retrieve and install ERLANG
################################################################################
pushd ${HOME}/work
git clone git://github.com/erlang/otp.git
pushd otp
export ERL_TOP=$PWD
export PATH=$ERL_TOP/bin:$PATH
./otp_build autoconf
./configure
make
popd
popd
################################################################################
# Retrieve and install DISCO
################################################################################
pushd ${HOME}/work
git clone git://github.com/discoproject/disco.git disco
pushd disco
export DISCO_TOP=$PWD
make
pushd lib
python setup.py install
popd
popd
popd
################################################################################
# Configure paths
################################################################################
cat >${HOME}/development_paths <<EOL
# Anaconda python distribution and disco.
export DISCO_HOME=${HOME}/work/disco
export PATH=${PTYHON_DISTRIBUTION}/bin:${ERL_TOP}/bin:${DISCO_TOP}/bin:\$PATH
EOL
# Brute force for multiple shells.
echo "source ${HOME}/development_paths" >> ~/.zshrc
echo "source ${HOME}/development_paths" >> ~/.zshenv
echo "source ${HOME}/development_paths" >> ~/.bashrc
echo "source ${HOME}/development_paths" >> ~/.bash_profile
echo "source ${HOME}/development_paths" >> ~/.profile
################################################################################
# Configure password-less ssh to localhost
################################################################################
mkdir -p ${HOME}/.ssh
ssh-keygen -N '' -f ${HOME}/.ssh/id_dsa
cat ${HOME}/.ssh/id_dsa.pub >> ${HOME}/.ssh/authorized_keys
chmod og-wx ${HOME}/.ssh/authorized_keys
#! /usr/bin/env bash
case $(id -u) in
0)
apt-get install -y git build-essential automake autoconf
sudo -u vagrant -i $0
;;
*)
git clone https://gist.github.com/9721691.git setup
pushd setup
. map_reduce.sh
popd
;;
esac
Vagrant.configure('2') do |config|
config.vm.box = "precise64"
config.vm.provision "shell", path: "provision.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment