Skip to content

Instantly share code, notes, and snippets.

@cwonrails
Forked from mikeal/install.bash
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwonrails/115110d1314ea094f6d3 to your computer and use it in GitHub Desktop.
Save cwonrails/115110d1314ea094f6d3 to your computer and use it in GitHub Desktop.
Install node.js on an Ubuntu Digital Ocean droplet.
#!/bin/bash
echo "Finding latest node version"
VERSION=`curl -s http://nodejs.org/dist/latest/SHASUMS.txt | awk '/node-v/ {print $2}' | head -1 | sed s/node-v// | sed s/-/\ / | awk '{print $1}'`
echo "Preparing to install node-v$VERSION"
url="http://nodejs.org/dist/v"$VERSION"/node-v"$VERSION".tar.gz"
echo "GET" $url
curl $url | tar -zxf -
cd "node-v"$VERSION
# Install dependencies
echo "Installing dependencies"
apt-get -y install build-essential openssl libssl-dev pkg-config &&
echo "Finished installing dependencies" &&
# Install node
echo "Installing node-v$VERSION"
./configure &&
make &&
make install &&
cd .. &&
rm -rf node-v$VERSION &&
node --version &&
exit
curl -s https://gist.github.com/cwonrails/115110d1314ea094f6d3/raw/c645f4574769b19328f6a8cd099882667f2e0a6e/doinstallnode.bash | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment