Installing Node.js and npm on Ubuntu 14.04 LTS

Finally got free from studies (semester ended) and now I am free to explore whatever I want in this vacation. Today I decided to start an adventure and explore Socket.IO, but it needs Node.js to be installed before I can start. So here I am! I searched online and found too many results, most of them for the older versions of Node.js and/or Ubuntu.

Here are the two best options I found for installing the latest versions of Node.js, which also installs npm automatically on Ubuntu 14.04 LTS. Note that these solutions would also work on (not tested personally!):

  • Debian 7 / stable (wheezy)
  • Debian testing (jessie)
  • Debian unstable (sid)
  • Ubuntu 12.04 LTS (Precise Pangolin)
  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 14.10 (Utopic Unicorn)
  • Corresponding releases of
    • Linux Mint
    • Linux Mint Debian Edition
    • elementary OS
    • Trisquel
    • Other Debian and Ubuntu-based distributions

Option 1: Downloading .tar.gz file, compiling and installing from it.

1. Go to and download the latest release source code (v0.12.3 at the time of writing this post).
2. Open the terminal (Ctrl+Alt+T in Ubuntu) and execute the following (assuming that the file was downloaded to ‘Downloads’, edit according to your location of the file):

$ tar -xvzf Downloads/node-v0.12.3.tar.gz

3. Navigate inside the directory:

$ cd node-v0.12.3/

4. Run the following commands one by one:

$ ./configure
$ make

Go take a walk while make does it’s job. Be patient, if its not over, go take another walk and come. Here is some description about the make command, while you wait for it to finish its job:

The purpose of the make utility is  to  determine  automatically  which
pieces of a large program need to be recompiled, and issue the commands
to recompile them. 
In a program, typically the executable file is updated from object files, 
which are in turn made by compiling source files.

Once, make finishes its job, execute the following command:

$ sudo make install

5. Test if it was installed by checking for the directory of installation:

$ which node

You should see the following output on your terminal:


6. That’s it!

Option 2: Installing from the deb repository of Node.js

1. Open the Terminal (Ctrl+Alt+T in Ubuntu) and execute the following command, which calls the setup script to correctly choose the installation file for your system:

$ curl -sL | sudo bash -

2. Then install Node.js using the following command:

$ sudo apt-get install -y nodejs

3. That’s it!

We are now up and ready for working with Node.js on your system. All the best for your adventure with Node.js as well! 🙂

sources: [1] [2]


What do you have to say? Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s