Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Linux » How to install Node.js on Ubuntu
  • image 2
    How to Fix Microsoft Edge Not Responding Windows
  • Screenshot 2022 03 21 at 18.06.30
    How to Configure Virtual Host for Apache HTTP Web Server to Host Several Domains on Ubuntu 20.04 LTS Linux
  • cv
    Add languages to Windows images using DISM and PowerShell Windows Server
  • officeinstallationandactivation
    How to install and activate Office 2019 on your Mac PC Microsoft Exchange/Office/365
  • djhfhjhg
    What is the difference between iDRAC, IPMI, and ILO Network | Monitoring
  • AWS Budgets
    How to create AWS Budget AWS/Azure/OpenShift
  • Trellix ePO Repair and reinstall
    Fix Trellix ePO DAT and Engine Packages missing Security | Vulnerability Scans and Assessment
  • Screenshot 2022 04 27 at 02.18.50
    Why does MBAM not automatically re-encrypt MBAM or Bitlocker-protected devices? Windows

How to install Node.js on Ubuntu

Posted on 23/03/202205/01/2026 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on How to install Node.js on Ubuntu
nodejs install on ubuntu

In this guide, we shall discuss how to install Node.js on Ubuntu. Node.js is a server-side programming runtime based on JavaScript. It enables developers to design scalable backend functionality using JavaScript. JavaScript is a language that many people are already familiar with through web development in the browser. Node takes JavaScript out of the browser. Please, see Dockerizing a NodeJs Express Application, and Synology NAS Domain Join: The Importance of DNS Configuration.

As a result, developers can utilize JavaScript to perform anything that other popular server-side languages like Ruby, PHP, C#, and Python can do. So, at its most basic level, NodeJS allows you to run JavaScript code on a machine other than a web browser, such as your local computer or a server. Do you want to learn how to install Node.js on Ubuntu? Read on to gain more insights about Node.js and the installation process.

NodeJS provides certain extra features that browser-based JavaScript doesn’t have, such as the ability to read and write local files, create HTTP connections, and listen for network requests. This tutorial will guide you on how to install Node.js on any Ubuntu server. While the commands will work on most servers but for the purpose of the demos, we used version 20.

Explore other guides here: Squid Proxy: How to setup and configure a Proxy Server/, How to install MariaDB on Ubuntu/, How to Install Terraform on Linux/, How to install Apache Tomcat on Ubuntu

Event-driven

Because of its single-threaded nature, Node.js is suitable for non-blocking, event-driven servers. It was created with real-time, push-based architectures in mind and is utilized for standard websites and back-end API applications. If we look through the official website of NodeJS nodejs.org for a proper definition, we will see that NodeJS is a JavaScript runtime.

The runtime is also event-driven and asynchronous at the same time. In this case, asynchronous means that you don’t try to forecast the exact order which each line will execute when you write your code. Instead, you write your code as a series of smaller functions that are invoked when certain events occur, like a network request (event-driven).

Consider the following scenario: you’re writing a program that must read text from a file, print that text to the console, query a database for a list of users, and filter those users based on their age.

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end('Hello World!');
}).listen(8080);

Essentially, this code creates a server and instructs it to “perform this callback function whenever we receive a network request.” The text ‘Hello World’ is returned by this function. That text would appear on your screen if you opened a browser and navigated to the correct location and port.

Please, see Fix npm install hangs on “sill idealTree buildDeps”, how to “Disable Developer Tools in Microsoft Edge using Registry or Group Policy in Windows, and How to manage automatic login on Ubuntu Linux.

Importance of Installing Node.js on Ubuntu

Calling other services using Node.js is simple. The majority of apps require seamless communication with the database and platform API.

  1. Node.js increases efficiency and can manage a large number of queries. It’s incredibly handy, practical, and speedy on the client side because it requires consumers to make fewer clicks and have everything loaded directly.
  2. Node.js allows developers to use JavaScript on both the server and the browser.
  3. With its lightweight and diverse tools, Node.js allows developers to speed up the development of online apps.
  4. Back-end frameworks run on Nodejs, which is an environment. Express.js is one of such frameworks (or just Express) is a popular HTTP server , while Socket.IO is a popular WebSocket server that also runs on NodeJS.
  5.  As a stand-alone platform, Node.js provides numerous advantages to the tech stack; for example, it includes the JSON module library. Node.js has become a major participant in several IT ecosystems, with over 368,985,988 downloads, or an average of 1,010,921 every day.

Prerequisites for Installing Node.js on Ubuntu

You should have a non-root user account with sudo rights set up on your system before you begin.

 Possibility No. 1: Installing with Apt from the Default Repositories

In Ubuntu 20.04’s default repositories, there is a version of Node.js that can be used to give a consistent experience across various platforms. The version in the repositories at the time of writing is 10.19. This will not be the most recent version, but it should be dependable.

The apt package manager can be used to obtain this version. To begin, refresh your local package index by typing:

$ sudo apt update 

Install NodeJS:

sudo apt install nodejs
how to install Node.js on Ubuntu

to check the version installed

node -v
how to install Node.js on Ubuntu-node-v

You should also install the Node.js package manager, npm. You can do this by using apt to install the npm package:

sudo apt install npm
npm-v

Using apt and the default Ubuntu software repositories, we were able to successfully install Node.js and npm.

 Possibility No. 2: Installing Node.js Using the Node Version Manager

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh
FIRST
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
how to install Node.js on Ubuntu-DOWNLOAD

The nvm script will now be installed in your user account. You must first source your.bashrc file in order to utilize it:

source ~/.bashrc

source the ~/.bash profile file with the command:

source ~/.bash profile

We can now ask NVM which Node versions are available:

nvm list-remote
how to install Node.js on Ubuntu-versions

It’s a lengthy list! By typing any of the release versions you see, you can install a version of Node. For example, to obtain version 14.10.0, type:

nvm install v14.10.0
how to install Node.js on Ubuntu-npms

you can see the various versions you have installed with the command below:

nvm list
how to install Node.js on Ubuntu-npmlist

On the first line, the display shows the currently active version (-> v14.10.0), followed by various named aliases and the versions to which those aliases point.

Summary

Node.js is outstanding and efficient at managing several requests at once. It takes others longer and costs less than other IT giants to handle your app’s traffic. We have installed Node.js on Ubuntu using two different methods, first, from the Default Repositories and lastly using the Node Version Manager.

I hope you found this guide on how to install Node.js on Ubuntu. Please, feel free to leave a comment below.

5/5 - (1 vote)

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:Ubuntu

Post navigation

Previous Post: How to apply Windows Updates with PowerShell
Next Post: How to install and configure Tripwire on Ubuntu

Related Posts

  • dns
    How to setup a cache-only DNS server Linux
  • feature linux boot process
    Linux Boot Process Explained Step by Step for Beginners Linux
  • 2FA For SSH in Linux
    Set Two-Factor Authentication for SSH in Linux Linux
  • feature image
    How to Configure Advanced PAM in Linux Linux
  • final tomcat feature
    How to install Apache Tomcat on Ubuntu Linux
  • Add User to Sudoers
    Add a User to the Sudoers List in Linux Linux

More Related Articles

dns How to setup a cache-only DNS server Linux
feature linux boot process Linux Boot Process Explained Step by Step for Beginners Linux
2FA For SSH in Linux Set Two-Factor Authentication for SSH in Linux Linux
feature image How to Configure Advanced PAM in Linux Linux
final tomcat feature How to install Apache Tomcat on Ubuntu Linux
Add User to Sudoers Add a User to the Sudoers List in Linux Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • image 2
    How to Fix Microsoft Edge Not Responding Windows
  • Screenshot 2022 03 21 at 18.06.30
    How to Configure Virtual Host for Apache HTTP Web Server to Host Several Domains on Ubuntu 20.04 LTS Linux
  • cv
    Add languages to Windows images using DISM and PowerShell Windows Server
  • officeinstallationandactivation
    How to install and activate Office 2019 on your Mac PC Microsoft Exchange/Office/365
  • djhfhjhg
    What is the difference between iDRAC, IPMI, and ILO Network | Monitoring
  • AWS Budgets
    How to create AWS Budget AWS/Azure/OpenShift
  • Trellix ePO Repair and reinstall
    Fix Trellix ePO DAT and Engine Packages missing Security | Vulnerability Scans and Assessment
  • Screenshot 2022 04 27 at 02.18.50
    Why does MBAM not automatically re-encrypt MBAM or Bitlocker-protected devices? Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,836 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.