Install node.js on Ubuntu 12+ and test with example server

Now that I’ve started to learn node.js to a project of mine thus there will be a few articles on node that you will see. And of course I am not an expert on this topic or any actually thus making any amendments will be welcome to improve this post

Ok so I am using Ubuntu 12.04 LTS and I think ubuntu works for me atleast for stuff I wanted to do. So after reading many articles online, this is how I successfully installed node on my ubuntu.

First we will need to install pre-requisites or dependencies before we can touch node so run the following commands to install


You will need to install these dependencies first

If something goes wrong while installing any of the above then try these steps before you repeat above

Installing for current user

Change to the directory your want to install node in. For this example lets keep it simple and create a nodejs directory first as shown below

If everything went smoothly then its time to get the source from GIT so here are the required steps for that

# update the environment path variable
echo ‘PATH=$PATH:$HOME/nodejs/bin’ >> $HOME/.bashrc
source ~/.bashrc

Please note that ./configure will do a check on dependencies and you will see problems in red if something went wrong.

Congratulations! Node is now installed and you are ready to rock

But just before that I would also recommend you to install node package manager (npm)

npm is now installed. npm is a good way to install node modules.

But Lets test our node install out

Somewhere where you would like to create a new project, just create a new file called index.js (please note that this is just a test thus I am not emphasizing on where and how to do your project structure)

I just use gedit to do this

Ok inside your index.js put this code in

Ok now in your browser address bar either put localhost:8080 or if it is a local network then point your browser to network address of your node server generally starts with 192.168.*.* or 10.1.*.* remember to put 8080 as port number because thats the port our node server is listening to.

You will see This is my first node program printed on your browser window.

I hope this helps.

There is something that I recommend if you are new to node I recommend you to read this awesome beginners tutorial that can be found here

I hope that this little post may have helped you.

Leave your comments to help me improve this post

I am also trialing my new wordpress plugin called WP Errata so a couple of paragraphs above are correctable by you.


VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)


  1. very nice! thanks for tech me

Leave a Reply