Installing Node.js on Linux

Download the compressed linux binaries from this link here corresponding to your version and architecture. The latest stable Linux 64 bit version at the time of writing this is 6.9.2. Extract into a suitable location. Add the path to the nodejs bin directory to your PATH variable.

$ wget
$ tar xf node-v6.9.2-linux-x64.tar.xz 
$ mv node-v6.9.2-linux-x64 /usr/local/nodejs
$ export PATH=$PATH:/usr/local/nodejs/bin

A better method is to use the package manager native to your Linux distribution. For Ubuntu or Debian based distributions, use apt-get and for Red Hat or Fedora, use yum. The package managers will ensure that all the dependencies are also installed.

On Fedora

# sudo yum install nodejs npm
Redirecting to '/usr/bin/dnf install nodejs npm' (see 'man yum2dnf')

Dependencies resolved.
Running transaction
  Installing  : libuv-1:1.10.0-1.fc25.x86_64           1/3 
  Installing  : nodejs-1:6.9.1-4.fc25.x86_64           2/3 
  Installing  : npm-1:3.10.8-     3/3 
  Verifying   : nodejs-1:6.9.1-4.fc25.x86_64           1/3 
  Verifying   : libuv-1:1.10.0-1.fc25.x86_64           2/3 
  Verifying   : npm-1:3.10.8-     3/3 

  libuv.x86_64 1:1.10.0-1.fc25   nodejs.x86_64 1:6.9.1-4.fc25       
  npm.x86_64 1:3.10.8-       



For RHEL (Red Hat Enterprise Linux) or CentOS, use the packages from EPEL repository

# sudo yum install nodejs npm --enablerepo=epel

When you install with package manager the PATH variable is set as well, so you don't have to add it manually.

Post a comment


Your Comment

Email (We dont publish it)


Nothing the first to share wisdom.