Skip to content

Instantly share code, notes, and snippets.

@MattMS
Last active July 21, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattMS/9162079434b449752dc0301e38a8ae33 to your computer and use it in GitHub Desktop.
Save MattMS/9162079434b449752dc0301e38a8ae33 to your computer and use it in GitHub Desktop.
Install Node.js on Ubuntu from package manager

Install Node.js on Ubuntu

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.

Add the key

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).

Add the package sources

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

Update packages and install

sudo apt-get update
sudo apt-get install nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment