This article will show us how to Install Node.js on Ubuntu 20.04.
Node.js is a free and open source JavaScript runtime platform used for traditional websites and back end API services. It is built on Chrome’s V8 JavaScript engine and designed for non blocking, event driven servers. It is famous to build, back end, front end, full stack and networking applications. NPM is a default package manager for Node.js server applications and has the world’s largest software registry. It helps you to create a complete web app development project with the help of a single programming language.
Nodejs is gaining popularity due to its ease of development process and delivers efficient performance. Generally, Node.js is used in the I/O bound Applications, Data Streaming Applications, Data Intensive Real time Applications, JSON APIs based Applications and Single Page Applications.
Follow this post in how to install Node.js on Ubuntu 20.04.
The simple and easiest way to install Node.js is to install it from the Ubuntu repository. However, the latest Node.js version is not available in the Ubuntu repository. The version included in the Ubuntu repository is 10.19.0.
You can check the information about the Node.js package with the following command:
apt show nodejs
You will get the package information in the following output:
In the next section of how to install Node.js on Ubuntu 20.04 is to install the NodeSource. NodeSource focuses on providing enterprise grade Node support and they maintain a repository containing the latest versions of Node.js. It allows you to install multiple Node.js versions in a single system. First, install the curl command line utility using the following command:
apt-get install curl -y
Next, add the NodeSource repository for Node.js version 16, run the following command:
NVM stands for “Node Version Manager” is a Node package manager that helps you manage and switch between different Node versions with ease. It provides a command line interface to install different Node.js versions using a single command.
First, install the NVM by running the following script:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14926 100 14926 0 0 27951 0 --:--:-- --:--:-- --:--:-- 27951
=> Downloading nvm from git to 'https://net.cloudinfrastructureservices.co.uk/home/vyom/.nvm'
=> Cloning into 'https://net.cloudinfrastructureservices.co.uk/home/vyom/.nvm'...
remote: Enumerating objects: 354, done.
remote: Counting objects: 100% (354/354), done.
remote: Compressing objects: 100% (302/302), done.
remote: Total 354 (delta 40), reused 157 (delta 27), pack-reused 0
Receiving objects: 100% (354/354), 207.03 KiB | 999.00 KiB/s, done.
Resolving deltas: 100% (40/40), done.
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm source string to /home/vyom/.bashrc
=> Appending bash_completion source string to /home/vyom/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Once the NVM is installed, close and reopen your terminal to start using nvm or run the following to use it now:
Next section of how to install Node.js on Ubuntu , we will show you how to create and run a simple Node.js application. First, create a file named hello.js using the following command:
In the above post, we explained how to install Node.js using three different ways. You can now choose your preferred method to install Node.js on your server. For more information, visit the Node.js documentation page.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
51vote
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.