Objective
Install the latest stable release of NodeJS on Debian Stretch.Distributions
Debian 9 StretchRequirements
This guide requires a functional install of Debian Stretch with root privileges.Difficulty
EasyConventions
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ - requires given linux commands to be executed as a regular non-privileged user
Introduction
NodeJS is on the rise, big time. It's one of the top web development tools, and when paired with the Express framework, it's solid direct competition to the likes of PHP and Ruby on Rails. Debian provides NodeJS in its repositories, but it's usually extremely out-of-date. There's no need to worry. The NodeJS Foundation recommends a Debian repository hosted by a popular NodeJS hosting service.Get And Run The Script
This part is super easy. It's actually what's recommended by the NodeJS Foundation. Use cURL to pull this Bash script. The script detects your distribution and sets up the repository for you. It even runs `apt update`. You should probably have `sudo` installed. If not, you either need to run the script as root(not usually a good idea). Just run the script separately instead of using the pipe.With Sudo
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Subscribe to RSS and NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
Without Sudo
$ cd Downloads $ curl -sL https://deb.nodesource.com/setup_10.x > setup_10.x $ chmod +x setup_10.x # ./setup_10.x
Install NodeJS
So, now that you have the repository set up, you can install NodeJS normally through `apt`.# apt install nodejs