Skip to content

Instantly share code, notes, and snippets.

@sghiassy
Created October 17, 2015 09:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sghiassy/f6376584950572e67fc8 to your computer and use it in GitHub Desktop.
Save sghiassy/f6376584950572e67fc8 to your computer and use it in GitHub Desktop.
A Bash shell script for provisioning a new Ubuntu 14.04 LTS VM built for React Native
#!/bin/bash
####################################
# Setup
####################################
tmpfile="/vagrant/.capacitor/runonce"
if [ -e ${tmpfile} ]; then
echo "Provisioning already completed. Remove ${tmpfile} to run it again."
exit 0
fi
####################################
# Install Software Packages
####################################
# Update base server & apt-get
apt-get update -y
apt-get -y upgrade
# Install Base packages
apt-get install -y build-essential gcc make g++ libxslt1-dev git-core manpages curl sl unzip vim acl
# Install MySQL Client
apt-get -y install libmysqlclient-dev mysql-client
# Install Node: http://askubuntu.com/questions/677498/unable-to-install-latest-nodejs-version-on-ubuntu-14-04
sudo apt-get purge nodejs*
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y nodejs
# Install Helpful Node Packages
npm install -g mocha
#### Install Watchman (necessary for Facebook Packager)
apt-get -y install automake autotools-dev python-pip python-dev
git clone https://github.com/facebook/watchman.git
cd watchman
./autogen.sh
./configure
make
sudo make install
cd ~
####################################
# Configure Environment
####################################
# On SSH login, change to the /vagrant (aka Vagrant synced folder) directory
echo "cd /vagrant" >> /home/vagrant/.bashrc
####################################
# Closing
####################################
# Set runonce flag
mkdir -p $(dirname ${tmpfile})
userMessage="This file exists to simply mark (or save state) that we have already provisioned the VM."
echo ${userMessage} > ${tmpfile}
userMessage=" Use command: 'npm run-script destroyVM' to cleanup this file and reset your VM"
echo ${userMessage} >> ${tmpfile}
chown vagrant ${tmpfile}
echo ""
echo " __ __ ___ __ ___ __ __ "
echo "\ / /\ / _\` |__) /\\ |\\ | | |__) |__ | / \\ /\\ | \\ "
echo " \\/ /~~\\ \\__> | \\ /~~\\ | \\| | | \\ |___ |___ \\__/ /~~\\ |__/ "
echo ""
echo "Provisioning complete. Please run 'vagrant reload' for new kernel. Have fun."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment