Skip to content

Instantly share code, notes, and snippets.

@alexandru
Forked from dwayne/00-install-on-64-bit-ubuntu-14.04.md
Last active December 17, 2015 10:49
Show Gist options
  • Select an option

  • Save alexandru/5597467 to your computer and use it in GitHub Desktop.

Select an option

Save alexandru/5597467 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Install script adapted from:
# https://gist.github.com/dwayne/2983873
NODE_DIR="$HOME/.nodejs"
echo 'export PATH=$HOME/$NODE_DIR/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/$NODE_DIR/lib/node_modules' >> ~/.bashrc
source ~/.bashrc
mkdir -p $HOME/$NODE_DIR/node-latest-install
cd $HOME/$NODE_DIR/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/$NODE_DIR # if SSL support is not required, use --without-ssl
# builds project
make && make install

Assumes a fresh install of Ubuntu 12.04 LTS.

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

     $ sudo apt-get install git-core curl build-essential openssl libssl-dev
    
  2. Change into the directory containing the install script and source it.

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

    N.B. This step takes a while.

  3. 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