Skip to content

Instantly share code, notes, and snippets.

@outbounder
Created July 18, 2012 15:57
Show Gist options
  • Save outbounder/3137115 to your computer and use it in GitHub Desktop.
Save outbounder/3137115 to your computer and use it in GitHub Desktop.
install node.js on ubuntu
#!/bin/bash
NODE=$1
NVMDIR=$2
NVM=$NVMDIR/nvm.sh
echo "installing node.js $1"
hash nvm 2>&- || {
echo "couldn't find nvm, checking for $NVM"
test -e $NVM || {
echo "couldn't find $NVM -> installing via git..."
hash git 2>&- || {
echo "couldn't find git -> installing git..."
sudo apt-get -y install git-core || exit 1
}
git clone git://github.com/creationix/nvm.git $NVMDIR || exit 1
}
. $NVM
}
test -e $NVMDIR/$NODE || {
echo "cound't find $NVMDIR/$NODE -> installing..."
sudo apt-get -y install g++ curl libssl-dev apache2-utils || exit 1
nvm install $NODE || exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment