How to install Node.js 6.x Long-Term Support (LTS) on Ubuntu/Debian and CentOS

Node.js 6.x is the current Node.js long-term support (LTS) release, with Node.js v6.9.4 being the most recent release as of time of writing. This guide shows a quick and reliable way to install the current Node.js 6.x LTS version (including npm) on Ubuntu/Debian and CentOS.

console.log("Hello World");

We will use the system package manager (eg. apt or yum) to install Node.js 6.x, to be able to continually receive security updates without risking a major version jump with possibly breaking changes.

You can jump directly to the installation instructions here:


About Node.js Long-Term Support (LTS)

Every major version covered by the LTS plan will be actively maintained for a period of 18 months from the date it enters LTS coverage. Following those 18 months of active support, the major version will transition into “maintenance” mode for 12 additional months.

via https://github.comnodejs/LTS#lts-schedule


Node.js LTS Schedule

Node.js 6 LTS will be actively maintained until April 2018, and passively maintained until April 2019, as shown in the image above. It is recommended to use the long-term support version for client projects, in order to be guaranteed a long active maintenance with security updates..


Installing Node.js 6.x LTS on Ubuntu and Debian

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

# Install Node.js 6.x repository
curl -sL https://deb.nodesource.com/setup_6.x | bash -

# Install Node.js and npm
apt-get install -y nodejs

The setup_6.x bash script basically just checks whether your operating system version is suppored and adds the corresponding repository (eg. https://deb.nodesource.com/node_6.x xenial InRelease).


Installing Node.js 6.x LTS on CentOS 7

Node.js provides a script for CentOS/Fedora/RHEL based distributions, which checks your operating system and adds the corresponding RPM repository for yum, the standard package manager:

# Install Node.js 6.x repository
curl -sL https://rpm.nodesource.com/setup_6.x | bash -

# Install Node.js and npm
yum install nodejs

The content of the script can be found here: https://rpm.nodesource.com/setup_6.x.


For feedback, ideas and recommendations, contact me on Twitter.

See also: