• About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap
Linux Tutorials for Beginners
Advertisement
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
  • Ubuntu
    Install and Secure phpMyAdmin on Ubuntu 22.04

    How To Install and Secure phpMyAdmin on Ubuntu 22.04

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Ubuntu 22.04

    Install Uptime Kuma on Ubuntu 22.04

    How To Install Uptime Kuma on Ubuntu 22.04

    Install Ubuntu Server 22.04

    How To Install Ubuntu Server 22.04 LTS with Screenshots

    Set Up Firewall on Ubuntu 22.04

    How To Set Up a Firewall with UFW on Ubuntu 22.04

    Install Nginx on Ubuntu

    How To Install Nginx on Ubuntu 22.04: A Comprehensive Guide

    Install MySQL 8.0 on Ubuntu 22.04

    How To Install MySQL 8.0 on Ubuntu Server 22.04

    install-php74-ubuntu2204

    How To Install PHP 7.4 on Ubuntu 22.04

    Install Snipe-IT on Ubuntu 22.04

    How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • Debian
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Debian 11

    Install Debian 11 Server

    How To Install Debian 11 (Bullseye) Server with Pictures

    Install and Setup Node.js on Debian 11

    How To Install and Setup Node.js on Debian 11

    Install PHP 8.2 on Debian 11

    How To Install PHP 8.2 on Debian 11

    Install Nginx on Debian 11

    How To Install Nginx on Debian 11: A Comprehensive Guide

    Set Up Firewall with UFW on Debian

    How To Set Up a Firewall with UFW on Debian 11

    install php74 on debian 11

    How To Install PHP 7.4 on Debian 11

    Install MariaDB 10.9 on Debian 11

    How To Install MariaDB 10.9 on Debian 11 Server

    Initial Setup Debian Server

    Initial Setup Debian 11 Server: Secure and Efficient

  • Rocky Linux
    Install phpMyAdmin on Rocky Linux 9

    How To Install phpMyAdmin on Rocky Linux 9

    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on Rocky Linux 9

    Install Rocky Linux 9.2 Server

    How To Install Rocky Linux 9.2 Server with Screenshots

    setup Firewall Using Firewalld Rocky Linux 9

    How To Set Up a Firewall Using FirewallD on Rocky Linux 9

    Install Nginx on Rocky Linux 9

    How To Install Nginx on Rocky Linux 9: A Comprehensive Guide

    Install Apache on Rocky Linux

    How To Install and Configure Apache on Rocky Linux 9

    Install MongoDB on Rocky Linux 9

    How To Install MongoDB 6.0 on Rocky Linux 9

    Install Docker on Rocky Linux

    How To Install Docker CE on Rocky Linux 9

  • CentOS
    Secure SSH with Fail2Ban

    How To Secure SSH with Fail2Ban on CentOS 7

    Install PHP8.2 on CentOS 7

    How To Install PHP 8.2 on CentOS 7 / RHEL 7

    Install Apache on CentOS 7

    How To Install Apache Web Server on CentOS 7

    Set Up FirewallD on CentOS 7

    How To Set Up a Firewall Using FirewallD on CentOS 7

    Initial Setup CentOS 7 Server

    Initial Setup CentOS 7 Server: Secure and Efficient

    Install Nginx on CentOS 7

    How To Install Nginx on CentOS 7: A Comprehensive Guide

    Build NGINX from Source on Centos 7

    How To Build NGINX from Source (Compile) on Centos7

    Install Docker Swarm on CentOS 7

    Install and Configure Docker Swarm Mode on Centos 7

    Install Docker Compose on Centos 7

    How To Install and Use Docker Compose on Centos 7

  • Linux
    Manage Groups on Linux

    A Simple Guide: How To Manage Groups on Linux

    Logrotate In Linux

    How To Manage Log Files Using Logrotate In Linux

    Check File Size in Linux

    The Easy Ways to Check File Size in Linux

    Linux server security system administrators

    Best Practices Linux Server Security for System Administrator

    Backup Files From Remote Linux VPS Using Rsync Script

    How To Backup Files From Remote Linux VPS Using Rsync Script

    SSH Key-based Authentication

    How To Configure SSH Key-based Authentication In Linux

    Linux File Permissions

    Understanding Linux File Permissions for Beginners

    Create Multiboot USB with Ventoy

    How To Create Multiboot USB with Ventoy in Linux

    Find Hard Disk Drive Information in Linux

    How To Find Hard Disk Drive Information in Linux

No Result
View All Result
Linux Tutorials for Beginners
No Result
View All Result

Home » Ubuntu » How To Install Node.js on Ubuntu 22.04 With 3 Different Ways

How To Install Node.js on Ubuntu 22.04 With 3 Different Ways

sammbysamm
October 17, 2023
Install Node.js on Ubuntu

How To Install Node.js on Ubuntu 22.04 With 3 Different Ways

Share on FacebookShare on LinkedinShare on Whatsapp

Introduction of Node.js

At the present time Node.js is a popular runtime environment for executing JavaScript on the server-side. It’s a key tool for web development and is known for its speed and versatility. For that reason this user-friendly step-by-step guide will walk you through the install Node.js on Ubuntu 22.04 With 3 Different Ways. Whether you’re an experienced developer or a beginner, you’ll have your Node.js environment up and running in no time. Let’s get started!.

As I have said, we’ll take you step by step through the process of installing Node.js on Ubuntu 22.04. We’ll cover three different methods: the Default repository, the NodeSource repository, and the Node Version Manager (NVM).

OTHER POSTS

How To Install and Secure phpMyAdmin on Ubuntu 22.04

How To Secure SSH with Fail2Ban on Ubuntu 22.04

How To Install Uptime Kuma on Ubuntu 22.04

Why Node.js on Ubuntu 22.04?

Before we dive into the installation process, let’s briefly discuss why Node.js on Ubuntu 22.04 is an excellent choice. Node.js allows you to create scalable and efficient server-side applications, making it a top choice for web development. Ubuntu 22.04, on the other hand, is renowned for its user-friendliness and long-term support, making it a reliable platform for hosting Node.js applications.

Table of Contents

  • Introduction of Node.js
  • Why Node.js on Ubuntu 22.04?
  • Key features of Node.js
  • Prerequisites for Install Node.js
    • System Update for Install Node.js
    • Method 1: Install Node.js with apt from the Default Repositories
      • Install Node.js with Default Repositories
      • Verify Node.js Installation
    • Method 2: Install Node.js from NodeSource Repository
      • Add the NodeSource Repository:
      • Install Node.js Using the NodeSource
      • Verify Node.js Installation
    • Method 3: Install Node Using the Node Version Manager (NVM)
      • Install NVM
      • Source NVM
      • Install Node.js with NVM
      • Verify Node.js Installation
  • Conclusion

Key features of Node.js

Node.js is well-known for its event-driven, non-blocking I/O model, which makes it efficient and lightweight for building real-time applications and server-side APIs. Key features of Node.js include:

  1. Asynchronous and Non-blocking: Node.js operates using an event loop, which allows it to handle multiple requests concurrently without blocking the execution of other code. This non-blocking I/O model makes it suitable for building fast and responsive applications.
  2. Server-side Development: Node.js is commonly used for server-side development to build web servers, APIs, and backend services.
  3. Package Manager (npm): Node.js comes with npm (Node Package Manager), which is one of the largest package repositories in the world. It allows developers to install, share, coupled with manage third-party libraries and packages needed for their projects.
  4. Scalability: Node.js is designed to handle a large number of concurrent connections efficiently, making it suitable for building scalable applications, real-time chat applications, gaming servers, and other applications that require high concurrency.
  5. Community and Ecosystem: Node.js has a vibrant and active community that continuously contributes to the growth of the platform. This has led to a rich ecosystem of libraries, frameworks, and tools that developers can leverage especially to streamline their development process.

Node.js has become incredibly popular for modern web development, especially for applications requiring real-time interactions, such as chat applications, streaming services, and online gaming platforms. Its performance, scalability, and extensive package ecosystem have made it a favorite among developers for building a wide range of applications and services.

Prerequisites for Install Node.js

Important to realize this guide assumes that you are using Ubuntu Server 22.04. Before you begin, you should have a non-root user account with sudo privileges set up on your system. You can learn how to do this by following :

  • Initial Server Setup Guide with Ubuntu Server 22.04.

System Update for Install Node.js

Basically It’s always a good practice to start by updating your package repository and upgrading installed packages to their latest versions. Update the package lists by running the following command:

Bash
samm@nodejs:~$ sudo apt update

Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:2 http://id.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://id.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
21 packages can be upgraded. Run 'apt list --upgradable' to see them.
Bash
samm@nodejs:~$ sudo apt upgrade

In this guide, given these points you will review three different ways of getting Node.js installed on a Ubuntu Server 22.04:

  • Using apt to install the nodejs package from default software repository.
  • Using apt with the Nodesource software repository to install specific versions of the nodejs package
  • Installing nvm, the Node Version Manager, and using it to install and manage multiple versions of Node.js

Method 1: Install Node.js with apt from the Default Repositories

Basically Ubuntu 22.04 already comes with a version of Node.js in its default repositories. This is pretty handy because it ensures a uniform experience when using Node.js on various systems. As of now, the version available in these repositories is v12.22.9. It might not be the absolute latest, but it’s reliable and perfectly suitable for some fast experimentation with the language.

Install Node.js with Default Repositories

To install Node.js and npm, you can use the official Ubuntu repository. To get this version, you can use the apt package manager by running the following command:

Bash
samm@nodejs:~$ sudo apt install nodejs npm

Verify Node.js Installation

Check that the install was successful by querying node for its version number using following command:

Bash
samm@nodejs:~$ node -v

Output

Bash
v12.22.9

If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. The Node.js package from Ubuntu Server 22.04’s default repositories also comes with npm, the Node.js package manager. This will allow you to install modules and packages to use with Node.js.

At this point you have successfully installed Node.js and npm using dnf and the default Ubuntu software repositories. Henceforth the next section will show you how to use an alternate repository to install different versions of Node.js.

Method 2: Install Node.js from NodeSource Repository

Basically Nodesource is a Node.JS partner that focusses on helping enterprises to run production-ready Node.Js applications with performance, stability and security in mind. This method is suitable if you want to install newer versions on Node.JS and NPM.

Add the NodeSource Repository:

For the most part NodeSource provides and installation script that updates the repository and adds the Nodesource repository to the sources list. In detail about the available versions, check out the NodeSource documentation. First, you’ll need to configure the repository locally, in order to get access to its packages. So download and run the script using the curl command as follows:

Bash
samm@nodejs:~$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

Then you should see the output similar to the following:

Bash
## Installing the NodeSource Node.js 18.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:2 http://id.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://id.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done

## Confirming "jammy" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_18.x/dists/jammy/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null

## Creating apt sources list file for the NodeSource Node.js 18.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Get:1 https://deb.nodesource.com/node_18.x jammy InRelease [4,563 B]
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease                                                                          
Hit:3 http://id.archive.ubuntu.com/ubuntu jammy InRelease                                                  
Hit:4 http://id.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://id.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:6 http://id.archive.ubuntu.com/ubuntu jammy-security InRelease
Get:7 https://deb.nodesource.com/node_18.x jammy/main amd64 Packages [775 B]
Fetched 5,338 B in 1s (4,715 B/s) 
Reading package lists... Done

## Run `sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn

Install Node.js Using the NodeSource

When you try to install nodejs with nodesource, you will get thihs error because you have existing nodejs.

Bash
(Reading database ... 101348 files and directories currently installed.)
Preparing to unpack .../nodejs_18.17.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.17.0-deb-1nodesource1) over (12.22.9~dfsg-1ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.17.0-deb-1nodesource1_amd64.deb (--unpack):
 trying to overwrite '/usr/include/node/common.gypi', which is also in package libnode-dev 12.22.9~dfsg-1ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_18.17.0-deb-1nodesource1_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

The repository will be added to your configuration and your local package cache will be updated automatically. You can now install the Node.js package in the same way you did in the previous section. It may be a good idea to fully remove your older Node.js packages before installing the new version, by using sudo apt-get remove nodejs npm.

This won’t change your settings in any way; but only update the installed software versions. Must be remembered that third-party repositories may not always package their software in a manner that seamlessly upgrades over the default packages. If you encounter any issues, for this reason you can always go back to the original, unmodified setup as a fallback option.

Bash
samm@nodejs:~$ sudo apt-get remove nodejs
samm@nodejs:~$ sudo apt-get purge nodejs
samm@nodejs:~$ sudo apt-get autoremove

After fully remove your older Node.js packages, next install the new version of Node.js using following command:

Bash
samm@nodejs:~$ sudo apt-get install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/28.9 MB of archives.
After this operation, 188 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 80313 files and directories currently installed.)
Preparing to unpack .../nodejs_18.17.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.17.0-deb-1nodesource1) ...
Setting up nodejs (18.17.0-deb-1nodesource1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...                                                                                                                       
Scanning candidates...                                                                                                                      
Scanning linux images...

Verify Node.js Installation

After that verify that you’ve installed the new version, by running following command:

Bash
samm@nodejs:~$ node --version

Output

Bash
v18.17.0

The NodeSource nodejs package contains both the node binary and npm, so you don’t need to install npm separately.

At this point you have successfully installed Node.js and npm using dnf and the NodeSource repository. Finally the next section will show how to use the Node Version Manager to install and manage multiple versions of Node.js.

Method 3: Install Node Using the Node Version Manager (NVM)

Another way of installing Node.js that is particularly flexible is to use nvm, the Node Version Manager. This piece of software allows you to install and maintain many different independent versions of Node.js, and their associated Node packages, at the same time.

Install NVM

Before install NVM on your Ubuntu Server 22.04 machine, visit the project’s GitHub page. This will get you the most recent version of the installation script. The URL you use will change depending on the latest version of nvm, but as of right now, the script can be downloaded and executed by typing:

Bash
samm@nodejs:~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

You will be some bunch of output on the terminal as shown.

Bash
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15037  100 15037    0     0  41154      0 --:--:-- --:--:-- --:--:-- 41197
=> Downloading nvm from git to '/home/samm/.nvm'
=> Cloning into '/home/samm/.nvm'...
remote: Enumerating objects: 360, done.
remote: Counting objects: 100% (360/360), done.
remote: Compressing objects: 100% (306/306), done.
remote: Total 360 (delta 40), reused 167 (delta 28), pack-reused 0
Receiving objects: 100% (360/360), 220.04 KiB | 4.31 MiB/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/samm/.bashrc
=> Appending bash_completion source string to /home/samm/.bashrc
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/usr/lib
├── [email protected]
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

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

Source NVM

Next, run the following commands to load nvm:

Bash
samm@nodejs:~$ export NVM_DIR="$HOME/.nvm"
samm@nodejs:~$ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
samm@nodejs:~$ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

Verify the installed nvm version using following command:

Bash
samm@nodejs:~$ nvm -v
0.39.1

To list all the available versions of Node.js using NVM, run the command:

Bash
samm@nodejs:~$ nvm ls-remote
Bash
Output
. . .
       v18.10.0
       v18.11.0
       v18.12.0   (LTS: Hydrogen)
       v18.12.1   (LTS: Hydrogen)
       v18.13.0   (LTS: Hydrogen)
       v18.14.0   (LTS: Hydrogen)
       v18.14.1   (LTS: Hydrogen)
       v18.14.2   (LTS: Hydrogen)
       v18.15.0   (LTS: Hydrogen)
       v18.16.0   (LTS: Hydrogen)
       v18.16.1   (LTS: Hydrogen)
       v18.17.0   (Latest LTS: Hydrogen)
. . .

As can be seen it’s a very long list! Afterwards you can install a version of Node by typing any of the release versions you see.

Install Node.js with NVM

For instance, to get version v18.1.0 (an LTS release), you can type:

Bash
samm@nodejs:~$ nvm install 18.1.0

You should then see the output similar to the following:

Bash
Downloading and installing node v18.1.0...
Downloading https://nodejs.org/dist/v18.1.0/node-v18.1.0-linux-x64.tar.xz...
##################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v18.1.0 (npm v8.8.0)

Verify Node.js Installation

You can see the different versions you have installed by typing following command:

Bash
samm@nodejs:~$ nvm list

->      v18.1.0
        v20.5.0
         system
default -> node (-> v20.5.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.5.0) (default)
stable -> 20.5 (-> v20.5.0) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.1 (-> N/A)
lts/hydrogen -> v18.17.0 (-> N/A)

This shows the currently active version on the first line (-> v18.1.0), followed by some named aliases and the versions that those aliases point to.

Conclusion

Finally Congratulations! You’ve install Node.js with a few ways on your Ubuntu Server 22.04. Thus you’re now ready to develop and deploy powerful web applications using Node.js. First thing to remember this installation provides a solid foundation for creating high-performance websites, and you’re well on your way to leveraging the capabilities of this powerful runtime. Happy coding!

Also Read Our Other Guides :

  • How To Install Node.js on Rocky Linux 9 With 3 Different Ways
  • How To Install and Setup Node.js on Debian 11
  • How To Install and Configure Go (Golang) on Ubuntu 22.04
  • How To Install and Configure NFS Server Client on Ubuntu 22.
  • How To Install Vagrant on Ubuntu 22.04
  • How To Install VirtualBox 7.0 on Ubuntu 22.04

As I have shown, now you have learned how to install Node.js on your Ubuntu 22.04 Server.

Tags: ApplicationJavaJavascriptNodeJSProgramming LanguageUbuntu

If you got help by our tutorials, please buy me a coffee..!

Buy Me a Coffee

Thank you so much for your support!!

Previous Post

Initial Setup Ubuntu Server 22.04: Secure and Efficient

Next Post

How To Install Snipe-IT Asset Management on Ubuntu 22.04

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

RECENT POST

Install and Secure phpMyAdmin on Ubuntu 22.04

How To Install and Secure phpMyAdmin on Ubuntu 22.04

by samm
July 22, 2024
0

Are you ready to take control of your MySQL databases on Ubuntu 22.04? In this step-by-step guide, we'll walk you...

Manage Groups on Linux

A Simple Guide: How To Manage Groups on Linux

by samm
November 12, 2023
0

Are you a Linux enthusiast looking to enhance your system administration skills? One fundamental aspect you should master is how...

Install phpMyAdmin on Rocky Linux 9

How To Install phpMyAdmin on Rocky Linux 9

by samm
November 11, 2023
0

If you're navigating the world of Rocky Linux 9 and looking to streamline your MariaDB or MySQL database management, installing...

Logrotate In Linux

How To Manage Log Files Using Logrotate In Linux

by samm
November 10, 2023
0

Log files are an essential part of any Linux system. They provide valuable insights into the system's activities, helping administrators...

Load More

RECOMMENDED.

Install Redis on Debian

How To Install Redis on Debian 11 Server

October 16, 2023
Secure SSH with Fail2Ban

How To Secure SSH with Fail2Ban on Rocky Linux 9

October 29, 2023
sammlinux sammlinux sammlinux

Related Posts

Install and Secure phpMyAdmin on Ubuntu 22.04
Ubuntu

How To Install and Secure phpMyAdmin on Ubuntu 22.04

July 22, 2024
Secure SSH with Fail2Ban
Ubuntu

How To Secure SSH with Fail2Ban on Ubuntu 22.04

October 29, 2023
Install Uptime Kuma on Ubuntu 22.04
Ubuntu

How To Install Uptime Kuma on Ubuntu 22.04

November 12, 2023
Install Ubuntu Server 22.04
Ubuntu

How To Install Ubuntu Server 22.04 LTS with Screenshots

October 21, 2023
Load More
Next Post
Install Snipe-IT on Ubuntu 22.04

How To Install Snipe-IT Asset Management on Ubuntu 22.04

  • About Us
  • Disclaimers
  • Privacy Policy
  • Sitemap

© 2023 sammlinux - Learn Today for Lead Tomorrow.

No Result
View All Result
  • Ubuntu
  • Debian
  • Rocky Linux
  • CentOS
  • Linux

© 2023 sammlinux - Learn Today for Lead Tomorrow.