Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Contact
  • Reviews
  • Toggle search form

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
  1. Home
  2. Linux
  3. 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.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • 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

  • feature photo quit vim
    How to Exit Linux Vim or Vi Editor Linux
  • Linux Shell Scripting 1
    Write a Shell Script that Count Lines and Words in a File Linux
  • systemd services
    How to use Systemd Timers on Linux Linux
  • feature image
    How to Configure Advanced PAM in Linux Linux
  • redisf
    How to install Redis on Linux System Linux
  • HOW TO AUTOMATE A PROCESS IN LINUX@
    Shell Scripting: How to Automate a Process in Linux Linux

More Related Articles

feature photo quit vim How to Exit Linux Vim or Vi Editor Linux
Linux Shell Scripting 1 Write a Shell Script that Count Lines and Words in a File Linux
systemd services How to use Systemd Timers on Linux Linux
feature image How to Configure Advanced PAM in Linux Linux
redisf How to install Redis on Linux System Linux
HOW TO AUTOMATE A PROCESS IN LINUX@ Shell Scripting: How to Automate a Process 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

Veeam Vanguard

  • Windows10 SCCM 20161
    What is ADK, MDT, Microsoft Endpoint Configuration Manager (SCCM), Intune, Autopilot, and WSUS Windows Server
  • ccsC
    NTuser.dat file: How to correctly load Windows Registry Hive Windows
  • sep hybrid backup tiny
    SEP sesam Hybrid Backup and Disaster Recovery Solution Backup
  • Windows server 2016 606x400 1
    How to install Windows Server 2016 Operating System on VirtualBox Windows Server
  • Security enhanced linux
    How to setup SELinux on a Linux server Linux
  • AADSTS50020  User from Identity Provider does not exist in Tenant
    AADSTS50020: User from Identity Provider does not exist in Tenant AWS/Azure/OpenShift
  • How to Set up a Single Site to Site VPN Connection on AWS
    Setup a Site-to-Site VPN Connection on AWS AWS/Azure/OpenShift
  • FIDO KEY FEATURE
    How to use a Fido Certified U2F Key for Authentication Password Manager

Subscribe to Blog via Email

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

Join 1,796 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 Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.