Prerequisites
To follow this tutorial you will need a non-root administrative user.
Installing Node.js
First, we will install the PPA in order to get access to its packages. (You can find the required version for you here: https://github.com/nodesource/distributions/blob/master/README.md) At the time of writing this v17 is the latest Node.js version.
cd ~
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
Then, run the installation script you just downloaded.
sudo apt-get install -y nodejs
Testing Node.js
To verify that you've installed Node.js correctly it's very simple! Just run the following command:
node -v
If everything's correct, you can find the version of Node.js installed outputted in your console.