To install Node.js on Ubuntu 22.04, you can follow the steps below:
Step 1 : Update the package repository:
Run the following commands to update the package repository information:
Step 2 : Import the repository GPG key:
- Install the required tools:
- Import the repository GPG key
Step 3 : Add the Node.js repository:
Add the Node.js repository to your system by running the following command:
Step 4 : Update the package repository again:
- After adding the Node.js repository, update the package repository to include the newly added repository:
Step 5 : Install Node.js and npm:
Now that the Node.js repository is added and the package repository is updated, you can proceed to install Node.js and npm (Node.js package manager) using the following command:
This command installs both Node.js and npm.
Step 6 : Verify the installation:
You can check the version of Node.js and npm to verify that the installation was successful:
These commands should display the installed versions of Node.js and npm, respectively.
You've successfully installed Node.js on Ubuntu 22.04. You can now start using Node.js to run JavaScript applications on your system.