Install Node.js on Ubuntu

Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn

Node.js is an amazing piece of technology for helping you develop scale-able mobile friendly websites and apps. It’s growing in popularity massively due to it’s logical and modern approach to web programming. Where as before you would need to learn something like Javascript for front end development and PHP for back end, Node lets you do everything using relatively the same code as it using a back-end language very similar to Javascript. This has made it popular with new developers wanting to learn full stack development and experienced developers who already know Javascript and similar languages.

On an Ubuntu server you can install the Distro stable version of Node.js via the terminal by running

sudo apt-get update
sudo apt-get install nodejs

Once that’s complete you will want to install the Node.js Package Manager (NPM)

sudo apt-get install npm

Once that’s all installed we can test the installation.

Create a file anywhere on your server called hello.js

in the file write the following:

console.log(‘Hello World’);

Then back on the terminal run

nodejs hello.js

The terminal should echo out “Hello World” note we’re typing “nodejs” and not just “node”. It’s called nodejs because node conflicts with an old Ubuntu package.

At this point you will probably be keen to see just how much of your Javascript knowledge will come in handy when working with node.js. It really is a strange feeling writing back end code in a front end language but it’s a modern take on web development.

Posted by Adi on October 28, 2016

Twitter Facebook Pinterest Google+ Stumbleupon LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *