2.4 KiB
title | description | published | date | tags | editor | dateCreated |
---|---|---|---|---|---|---|
How to install NodeJS | How to install NodeJS on Ubuntu 22.04 | true | 2023-06-26T13:04:30.081Z | nodejs, ubuntu, installation, linux, server, ubuntu, ubuntu 22.04 | markdown | 2023-06-26T13:04:59.640Z |
Guide to Node.js Installation on Ubuntu 22.04
Node.js is a popular open-source JavaScript runtime built on Chrome's V8 JavaScript engine. It allows you to build scalable and high-performance server-side applications using JavaScript. This guide will walk you through the installation process of Node.js on Ubuntu 22.04.
Prerequisites
- A system running Ubuntu 22.04
- A user account with sudo privileges
- An internet connection
Installation Steps
- Begin by updating your apt repository to ensure you have the latest package information and dependencies. Open a terminal and run the following command:
sudo apt update
This command will refresh the package lists and update any outdated packages on your system.
- Install the curl utility if it's not already installed. curl is used to transfer data to or from a server using various protocols. Execute the following command in the terminal to install it:
sudo apt install curl
This command will download and install curl from the Ubuntu repositories.
- Now, you can proceed with the installation of Node.js. Run the following command in the terminal to download and execute the Node.js setup script: (replace "version" with the version you want to install, e.g. 18)
curl -fsSL https://deb.nodesource.com/setup_version.x | sudo -E bash -
This command fetches the setup script from the NodeSource repository and pipes it to the bash shell with elevated privileges (sudo), allowing it to modify system files.
- Once the setup script has been executed, you can install Node.js by running the following command:
sudo apt install -y nodejs
This command installs Node.js and its package manager, npm, using the package manager apt.
- After the installation is complete, you can verify the Node.js and npm versions by running the following commands:
node --version
npm --version
You should see the version numbers of Node.js and npm printed in the terminal, indicating a successful installation.
Finished
Congratulations! You have now installed Node.js on your Ubuntu 22.04 machine. Node.js is ready to be used for developing your JavaScript applications.