ScaleScaleScaleScale

Tips / Nginx


How to Install latest Node.js version on Ubuntu 12.04

Node.js is an event-driven programming language that is used to build scalable applications and network services (specially used to build web services). On this tutorial I will show you how to install latest NodeJS version on Ubuntu Linux under your local home directory.

Pre requirements

Common compiling tools and Wget are two things that you must have in order to install latest node.js version on your Ubuntu box:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install wget

Installing NodeJS and NPM (Node Package Manager)

This specific installation is very straightforward and installs node.js on the user’s local system alone.

Change the path to include commands from your home local/bin directory.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc

Source the .bashrc file:

. ~/.bashrc

Create necessary directories

mkdir ~/local && mkdir ~/node-latest-version

Move to the nodejs installation directory

cd ~/node-latest-install

Get the node.js tar.gz file and extract it:

wget http://nodejs.org/dist/node-latest.tar.gz
tar -xvpzf node-latest.tar.gz

Move to the extracted directory (in my case is node-v0.10.25)

cd node-v0.10.25

Start installing NodeJS to your local user path, this way ensures you won’t need to use sudo command to execute NodeJS later:

./configure --prefix=~/local

Type make install to complete the installation (it may take a while, be patient)

make install

Now one thing you will need to work properly with NodeJS is NPM node package manager:

wget https://npmjs.org/install.sh
sh install.sh

Some common NPM modules I suggest you to install:

npm install connect-redis jade express express-resource futures emailjs mysql mongodb async request socket.io mongoose stylus uglify-js connect-proxy sng nginx-stubstatus

Check your NodeJS installation:

node -v

At this time you should have the latest NodeJS version up and running on Ubuntu 😀

Popular search terms:

  • ubuntu 12 10 nodejs version
  • ubuntu 12 npm
  • how to install nodejs in ubuntu 12
  • install node js ubuntu 12 04
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking