Less than a week ago, Node.js 20 release. While it’s not the current LTS release, it will be this coming October 2023.
You’re probably wondering why this post is about Ubuntu 20.04 LTS considering there is a newer LTS release and multiple non-LTS releases that I could be targeting. Kinda just going with what the traffic trends are on my blog. Based on that, it seems like Ubuntu 20.04 LTS is alive and well in the wild.
Not just that, Ubuntu 20.04 is a long-term support release, so it’s going to be getting some love for a while.
Fortunately though, these instructions can be easily applied to newer versions of Ubuntu, like 22.04 LTS and the recently released Ubuntu 23.04, as well as many modern versions of Debian. If you’re distro is based on either of those, there’s a good chance this will work there too.
All right, so let’s get started! First, I always like to make sure my system is
up to date and that we have curl
installed:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install -y curl
With the system and the necessarily dependencies ready to go, we can grab the setup script for Node.js 20 and give it a spin:
$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
This script will add the new apt
sources and runs another apt update
to get
us ready to install nodejs
. Installing nodejs
takes one more step:
$ sudo apt install -y nodejs
With nodejs
installed, you can check to see that everything worked out as we
would have expected, but running the node
command with the --version
argument:
$ node --version
v20.0.0
If the version that’s output is v20.something.something
, v20.0.0
at the time
of this writing, you’re in great shape! If that’s not the case, I’d scroll to
the top and start over as you may have missed a step, or missed an error that
showed up along the way.