In this guide, we will explore a quite known method of installing Node.js: through the NodeSource repository
Pre-requisites and assumptions
- This guide is designed to fit Ubuntu 18.04 systems, but can apply to Debian 9, although I won’t provide support for Debian.
- You should have also setup a
sudouser. Installing stuff as
rootis possible, but highly discouraged
But why should I install it with a PPA?
The reason is simple: It is installed system-wide. This means, you don’t have to install a (quite dodgy) script every time on every new user that needs node.js.
So let me begin with…
Step 1: Updating your system packages
This should be fairly easy for a great sysadmin like you winkwink. Just run
sudo apt update sudo apt upgrade
When that is finally finished, you should advance to …
Step 2: Adding the repository
First, make sure GPG is installed by running
# install the gnupg package sudo apt install gnupg
and then add the repo by using
# This is a script provided by NodeSource. Replace VERSION with the version you want to get curl -sL https://deb.nodesource.com/setup_VERSION.x | sudo -E bash -
Step 3: Installing node.js
sudo apt install nodejs
And… that’s it!
EXTRA: Install the C++ build tools
# Installs the build-essentials package group sudo apt install build-essential