Skip to content

Instantly share code, notes, and snippets.

@tnhu
Created April 26, 2012 23:44
Show Gist options
  • Select an option

  • Save tnhu/2504221 to your computer and use it in GitHub Desktop.

Select an option

Save tnhu/2504221 to your computer and use it in GitHub Desktop.
Install NodeJS
#!/bin/sh
VERSION=0.6.7
NAME=node-v$VERSION
DEST=$HOME/$NAME
TMP=$HOME/tmp/$NAME
echo This script installs NodeJS v$VERSION into $DEST
path=`pwd`
rm -rf $DEST
mkdir $DEST
rm -rf $TMP
mkdir -p $TMP
cd $TMP
curl -O http://nodejs.org/dist/v$VERSION/node-v$VERSION.tar.gz
tar -zxvf node-v$VERSION.tar.gz
cd node-v$VERSION
./configure --prefix=$DEST && make install
# In some system, node and npm don't have +x
chmod +x $DEST/bin/node
chmod +x $DEST/bin/npm
echo PATH=$DEST/bin:\$PATH >> ~/.bashrc
source ~/.bashrc
cd $path
# cleanup
rm -rf $TMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment