Upgrade to Node.js 8.x on Debian and Ubuntu

Not too long ago I wrote a post on how to upgrade to Node.js 8.x on Ubuntu
17.10. Post has done well but it’s generated quite a few inquiries on if it
would work on other versions of Ubuntu, specifically LTS versions.

This guide should work for both Debian (Wheezy, Jessie, Stretch AND BEYOND!),
Ubuntu (14.04 LTS, 16.04 LTS, 18.04 LTS [yep even that] and everything in
between) but also derivatives like elementaryOS and Linux Mint!

At the time of this writing, Node.js 8.x is the latest LTS (long term support)
release and will remain so until October 2018 when 10.x takes over.

To get started, make sure you have curl installed, or just adjust the
instructions to accommodate your downloader of choice:

sudo apt-get install curl

Next up, download the Node.js 8.x installer and run it:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Will take a brief moment to do it’s thing.

What that script will do is create a sources list file in
/etc/apt/sources.list for the NodeSource repo for Node 8.x for your
distribution.

Once that’s done, you’ll want to resynchronize your package index files and get
the index file from the new repository err, I mean just run:

sudo apt-get update

Now for the fun part, let’s get Node.js 8.x installed:

sudo apt-get install nodejs

If you happened to already have Node.js installed, the install command will
upgrade you to the new version.

I’m a cautious fellow when it comes to upgrading software, so I’d also check the
version that the node command spits out:

node --version

If everything went according to plan, you should be running the latest version
of the 8.x release of Node.js!

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.