Skip to content

TechDirectArchive

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

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

How to install Node.js on Ubuntu

Posted on 23/03/202216/08/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.

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
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

  • Screenshot 2020 05 14 at 17.47.09
    Configure OpenSSH Server: A Quick Guide Linux
  • Package1
    Install Synaptic Package Manager: Handle packages in Ubuntu Linux
  • sdfdghjk
    How to fix “Job for Mattermost service failed” error Linux
  • linuxnethero
    Adding a subnetwork interface to an existing network interface Linux
  • image 129
    How to deploy Ansible AWX on centos 8 Linux
  • feature photo quit vim
    How to Exit Linux Vim or Vi Editor Linux

More Related Articles

zabbix Monitoring services using Zabbix Linux
Screenshot 2021 02 05 at 22.40.51 Disable automatic screen lock on Ubuntu Desktop Linux
Screenshot 2020 05 14 at 17.47.09 SSH access on Ubuntu server: Easy Guide Linux
DNS FEATURE Domain Name System: All you need to know about DNS Linux
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
ssh How to disable RC4 Cipher Algorithms support in SSH Server Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • article 1280x720.192a2586 1
    Windows Always On VPN (AOVPN) Overview and Requirements Windows Server
  • Remove Bing Chat Button from Edge Sidebar
    How to Remove Bing Chat Button from Edge Sidebar Windows
  • vSwitches
    vSwitches: How to delete Virtual Switches from Hyper-V Virtualization
  • fxcgbnm
    How to export and import Windows Start layout Windows
  • Webp.net resizeimage 3 1
    How To Configure VM Update Management on Azure Stack Hub AWS/Azure/OpenShift
  • Featured image Desktop Stickers
    How to create Desktop Stickers in Windows 11 Windows
  • disable camera in Windows
    How to disable Camera Access in Windows Windows
  • Featured image
    Tamper Protection for Microsoft Defender on Windows 10 [Part 1] Security | Vulnerability Scans and Assessment

Subscribe to Blog via Email

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

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

Tags

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

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.