Skip to content

Instantly share code, notes, and snippets.

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 hasan3ysf/8702777 to your computer and use it in GitHub Desktop.
Save hasan3ysf/8702777 to your computer and use it in GitHub Desktop.

Assumes a fresh install of Ubuntu 12.04 LTS.

check: http://howtonode.org/how-to-install-nodejs Install the dependencies: sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core

can see also: http://www.codediesel.com/linux/installing-node-js-on-ubuntu-10-04/ and https://gist.github.com/isaacs/579814

  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:

  1. Navigate to http://nodejs.org/download/ and on the Linux Binaries (.tar.gz) row click to download the 64-bit version of the current latest release.

  2. Say you've downloaded node-v0.10.7-linux-x64.tar.gz into the Downloads directory. Then, open the terminal and type the following:

     $ cd ~/Downloads
     $ mkdir -p ~/local/node
     $ tar xzf node-v0.10.7-linux-x64.tar.gz -C ~/local-test/node --strip-components=1
     $ echo 'Node Enviroment Setup' >> ~/.bashrc
     $ echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.bashrc
     $ echo 'export NODE_PATH=$HOME/local/node/lib/node_modules' >> ~/.bashrc
     $ . ~/.bashrc
    
  3. No step 3. That's it.

# The install script
# Adapted from https://gist.github.com/579814
echo '# Added by install script for node.js and npm in 30s' >> ~/.bashrc
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
echo 'export NODE_PATH=$HOME/local/lib/node_modules' >> ~/.bashrc
. ~/.bashrc
mkdir -p ~/local
mkdir -p ~/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...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment