The official instructions say to download and run a script with sudo
, which should sound scary.
So I went through the script and wrote up what it is doing.
It's actually fine to run, but it's not much harder to do it all yourself.
curl https://deb.nodesource.com/gpgkey/nodesource.gpg.key > key
sudo apt-key add key
You can then rm key
or have a peek at the key
file contents if you're curious (curiousity is good).
Use lsb_release -c -s
to check if your distro is trusty
, if not, replace trusty
in the commands below.
You can also replace node_8.x
with node_6.x
for Node 6.
Create /etc/apt/sources.list.d/nodesource.list
, containing the following:
deb https://deb.nodesource.com/node_8.x trusty main
deb-src https://deb.nodesource.com/node_8.x trusty main
sudo apt-get update
sudo apt-get install nodejs