Skip to content

Instantly share code, notes, and snippets.

@jamiekurtz
Last active May 10, 2018 17:23
Show Gist options
  • Save jamiekurtz/b3fa4904ae21e5c5b947 to your computer and use it in GitHub Desktop.
Save jamiekurtz/b3fa4904ae21e5c5b947 to your computer and use it in GitHub Desktop.
Provisioning script (used primarily for Vagrant) for an Ionic+Android build server on Ubunutu
#!/bin/bash
# some exports needed for this script
# ... don't forget to export these to ~/.bashrc later!
export NPM_PACKAGES=~/.npm_packages
export NODE_PATH=$NPM_PACKAGES/lib/node_modules
export ANDROID_HOME=~/android-sdk-linux
export PATH=$PATH:$NPM_PACKAGES/bin:$NODE_PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
# Install and configure NodeJS
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get -y install git nodejs build-essential
mkdir -p $NPM_PACKAGES
npm set prefix $NPM_PACKAGES
# install global packages for cordova/ionic/etc.
npm install -g node-gyp
npm install -g gulp
npm install -g bower
npm install -g cordova
npm install -g ionic # (sometimes fails on the first try... so do it again...)
npm install -g ionic
# install Java
sudo dpkg --add-architecture i386
sudo apt-get -y update
sudo apt-get -y install libncurses5:i386 libstdc++6:i386 zlib1g:i386
sudo apt-get -y install openjdk-7-jdk
# install Android SDK
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar zxvf android-sdk_r24.2-linux.tgz
# Android SDK tools and platforms
# ... run this to get the package names for the --filter parameter below: android list sdk --all --extended
sudo apt-get install -y ant
echo y | android update sdk -u --all --filter platform-tools,build-tools-22.0.1,android-22
# export stuff to ~/.bashrc
cat <<BASHRC >> ~/.bashrc
export NPM_PACKAGES=$NPM_PACKAGES
export NODE_PATH=$NODE_PATH
export ANDROID_HOME=$ANDROID_HOME
export PATH=$PATH
BASHRC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment