Installing NodeJs On Ubuntu Based Systems

Installing NodeJs On Ubuntu Based Systems

To install Node.js binary version on Ubuntu-based systems, there are multiple options available. Here are step-by-step instructions for installing nodeJS on Ubuntu using different methods:

Option 1: Installing Node.js from the Ubuntu repositories using apt

  1. Update your local package index with the command:

     sudo apt update
    
  2. Install Node.js and npm by running the command:

     sudo apt install nodejs
    
  3. Check if Node.js was installed correctly by running the following command. It will tell the version of NodeJS installed if the installation was successful.

     node --version
    

Note: The version of Node.js included in the Ubuntu repositories may not be the latest version available. If you need a different version, consider using the second method

Option 2: Installing Node.js using the Node Version Manager (nvm)

  1. Visit the following website: https://github.com/nodesource/distributions

  2. Select the version which you want to install among the various versions given. We will be sticking to the LTS version as an example

    Various versions of nodejs availaible

  3. Install the LTS version (currently it is 18.16.0) by running the following command in the terminal:

     curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
     sudo apt-get install -y nodejs