How to install Node.js 5.x on CentOS and Ubuntu/Debian

Node.js v5.x is deprecated. Take a look at the current instructions on how to install Node.js 6.x Long-Term Support (LTS) and Node.js 7.x.


Node.js v5.0.0 (stable) was released today, just a month after the v4.x long-term-support (LTS) release! Here is a quick and easy way to install the current Node.js 5.x (including npm) on CentOS and Ubuntu/Debian.


Installing Node.js 5.x on CentOS 7

The easiest way is to install the latest Node.js 5.x from the official RPM repository with the standard package manager, which has the advatage of automatically being able to get updates to Node.js:

# Install the Repository
rpm -Uvh https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm

# Install Node.js
yum install nodejs

This is basically the short version of running the official CentOS/Fedora/RHEL install script: https://rpm.nodesource.com/setup_5.x


Installing Node.js 5.x on Ubuntu and Debian

This is the official way to install Node.js 5.x on Ubuntu, Debian, Linux Mint, Linux Mint Debian Edition (LMDE) and elementaryOS :

# Installing Node.js 5.x on Ubuntu / Debian
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Enjoy Node.js 5.x, and reach out to me on Twitter @metachris

See also: