Blog de programación, errores, soluciones

Chose Language:
Author: Admin/Publisher |not checked

How to install Node.js on Linux

This post was created by pure necessity, it was not planned. A time ago, Node.js gave a preinstallation .deb file that you could install easily. Nowadays, Node just give you the binary file, and you need to do with it the installation.

You could say ¿why not install it with apt-get?

Well that’s not an option apt get just not have the latest version of node, that’s why is better to install it via node.js page.

Differences between binaries

At a first look we can see that we have 2 types of binaries at the download page ARM and x64, if you are relative new at this you probably don’t know what is this. These 2 options are option for your processor architecture, the great majority of pc uses x64, tables, cellulars and others devices uses ARM

What binary I need to chose ARM or x64?

Well do not worry about it, principal page of Node.js give a download option with the binary for our architecture.

Install Node.js on Linux.

In order to install node.js you need to download the binary that comes in a tar file for example node-v..*-linux-x64.tar.xz

Then you need to extract the files, you can use the Linux interface, or you can do it via console commands. In my case I used the interface, you can just right-click the file and select extract.

If you chose make it by console you can do the following:

sudo tar -xJvf node-v**.**.*-linux-x64.tar.xz

Take in considerations that I use * instead of the version numbers.

After extracting the files on the tar file we need to put the folder in the directory we want the installation. The recommended directory is /home. Another options are usr/local or /opt

In this example we are going to install it at home directory.

Again in my case I used the Linux interface to move node-v**.**.*-linux-x64 to /home

To move it via console put the following on your command line, in my case I’m moving the file from Downloads folder.

mv node-v**.**.*-linux-x64 /home/nodejs

Once you have the folder in its place we need to set the variable environment:

export PATH=/home/nodejs/bin:$PATH

Finally, check if your installation works by checking Node and NPM versions:

node -v
npm -v
Category: en-others
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category