Skip to content

Instantly share code, notes, and snippets.

@kmpm
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmpm/9321341 to your computer and use it in GitHub Desktop.
Save kmpm/9321341 to your computer and use it in GitHub Desktop.
vagrant-ubuntu-precise
#!/bin/bash
echo '.. checking apt cache'
timestamp_file="$(mktemp)"
touch -d "$(date -R -d '1 day ago')" $timestamp_file
file=/var/lib/apt/periodic/update-success-stamp
if [ $file -ot $timestamp_file ]; then
echo '.. old apt cache'
apt-get update
apt-get upgrade -y
fi
echo '.. cleaning up'
apt-get autoremove -y
#!/bin/bash
echo '.. installing mongodb'
function failed {
echo
echo 'Something failed !!!!!'
echo
exit 1
}
function checkfail {
if [ ! $? -eq 0 ]; then
failed
fi
sleep 3
}
LISTFILE="/etc/apt/sources.list.d/mongodb.list"
if [ ! -f "$LISTFILE" ]; then
echo '.. Adding MongoDB Apt source'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' > $LISTFILE
apt-get update
apt-get install -y mongodb-10gen
else
echo '.. mongodb seems to be installed'
fi
#!/bin/bash
function failed {
echo
echo 'Something failed !!!!!'
echo
exit 1
}
function checkfail {
if [ ! $? -eq 0 ]; then
failed
fi
sleep 3
}
echo '.. installing dependencies and tools'
apt-get install -y build-essential openssl libssl-dev pkg-config
checkfail
NODEVERSION=${NODEVERSION-v0.10.25}
echo '.. downloading node-$NODEVERSION'
cd /tmp
wget http://nodejs.org/dist/$NODEVERSION/node-$NODEVERSION.tar.gz
checkfail
tar -zxf node-$NODEVERSION.tar.gz
checkfail
cd node-$NODEVERSION
echo '.. configuring node-$NODEVERSION'
./configure
checkfail
echo '.. compiling node-$NODEVERSION'
make
checkfail
echo '.. installing node-$NODEVERSION'
make install
checkfail
echo '.. installing some npm packages gulp and nodemon globaly'
npm install -g nodemon gulp
checkfail
if grep -q "node_modules" "/home/vagrant/.bashrc"
then
echo '! not the first time provision is run ?'
else
cat <<EOF >> /home/vagrant/.bashrc
export PATH=./node_modules/.bin/:$PATH
EOF
fi
#!/bin/bash
echo '.. installing rabbitmq'
RABBITSOURCE="/etc/apt/sources/list.d/rabbitmq.list"
if [ ! -f "$RABBITSOURCE" ]; then
echo "deb http://www.rabbitmq.com/debian/ testing main" > "$RABBITSOURCE"
wget -qO - http://www.rabbitmq.com/rabbitmq-signing-key-public.asc | apt-key add -
apt-get install -y rabbitmq-server
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment