Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created January 22, 2011 19:58
Show Gist options
  • Save adilsoncarvalho/791408 to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/791408 to your computer and use it in GitHub Desktop.
Bash to install node.js and google v8 on an ubuntu machine
#!/bin/bash
USER=`whoami`
if [ "$USER" != 'root' ]; then
sudo $0 || { echo " * Sorry, must be superuser to do that... marmita user not allowed"; exit 1; }
else
#
# I've decided to put it on opt ... do you have an better idea?
#
cd /opt
git clone https://github.com/ry/node.git node.js || { echo ' * Could not get node.js'; exit 1; }
#
# we need some dependencies
#
apt-get install --yes curl openssl lib-ssl || { echo ' * Got an error when trying to get some dependencies'; exit 1; }
cd node.js
./configure || { echo ' * Error setting up your makefile'; exit 1; }
make || { echo 'ups... the make made a boo boo'; exit 1; }
#
# Don't know why the file isn't where it was supposed to be
#
ln -s build/default/config.h config.h
make install
#
# Again, I don't know why it don't put node's bin on path
#
ln -s /opt/node.js/build/node /usr/bin/node
echo 'Success!!! Give it a try... type console.log("Hello World"); to see what happens :)'
node
fi
# Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment