Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thomasbabuj/4691846 to your computer and use it in GitHub Desktop.
Save thomasbabuj/4691846 to your computer and use it in GitHub Desktop.
# The install script
# Adapted from https://gist.github.com/579814
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/local/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/Downloads/node-latest-install
cd ~/Downloads/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local # if SSL support is not required, use --without-ssl
make install # ok, fine, this step probably takes more than 30 seconds...

Assumes a fresh install of Ubuntu 12.04 LTS.

  1. Setup the system to handle compiling and installing from source.

     $ sudo apt-get install build-essential
    
  2. If SSL support is needed then we will need to install libssl-dev.

     $ sudo apt-get install libssl-dev
    
  3. The install script uses curl, so we will need to install curl.

     $ sudo apt-get install curl
    
  4. Change into the directory containing the install script and source it.

     $ . node-and-npm-in-30s.sh
    

    N.B. This step takes a while.

  5. Finally, check that the latest version of node and npm are indeed installed.

     $ node -v
     $ npm -v
    

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment