I thought I would write a quick tutorial on how to install NodeJS on Ubuntu as I have a need to set up a Virtual Development Environment and while I’m installing NodeJS on it anyway I might as well document the process.
I will be using Ubuntu Desktop 18.04 for the environment but this installation should work with any Debian based distribution.
For this installation, I want to use the current Long Term Support (LTS) version of NodeJS which at the time of writing is 12.16.1. You can always find out the latest versions of NodeJS at the NodeJS Website
The NodeJS documentation recommends using the NodeSource repositories when installing on Ubuntu. You can find instructions for a variety of distributions over at the NodeSource GitHub.
Open a terminal and the first thing we need to do is add the NodeSource Software Repository. NodeSource provides a script to do this which is what I’m going to use. If this was a production server, I would check the script before running it but as this is just for testing I’m going to run it directly from the download.
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Now that we have the repository added to our system we can install NodeJs as we would install any package on Ubuntu.
sudo apt install -y nodejs
Once the installation has completed we can confirm that it has worked as expected by checking the version of node installed.
So I know this was a quick little tutorial but I thought it might be handy to have all the information in one place and as I was installing it anyway I might as well write about it as I do it.
If you like these little tips let me know in the comments and I’ll write more of them as I play with software in the future.