Nodejs is a cross platform runtime, you can install it on almost every popular OS.

However nodejs’ version managed by each OS’ package manager can be different and obsolete.

So just install it from nodesource, the official script will take care of the package source and version.

Debian and Ubuntu based distributions

LTS

1
2
3
4
5
6
7
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs

Current

1
2
3
4
5
6
7
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs

# Using Debian, as root
curl -fsSL https://deb.nodesource.com/setup_current.x | bash -
apt-get install -y nodejs

Enterprise Linux based distributions

LTS

1
2
3
4
5
# As root
curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -

Current

1
2
3
4
5
# As root
curl -fsSL https://rpm.nodesource.com/setup_current.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -