- sudo apt update
This command updates the local database of available packages and their versions from the repositories.
- sudo apt install curl
Curl is a command-line tool used to transfer data to or from a server. It's used here to download the script for setting up Node.js.
- sudo apt install
- curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
This command uses curl to retrieve the setup script for Node.js LTS version from the NodeSource repository. The -fsSL flags tell curl to fail silently on errors, follow redirects, and show progress in a user-friendly way. The script is then executed using sudo -E bash - to set up the repository for Node.js.
- sudo apt install nodejs
After running the setup script, this command installs Node.js and npm (Node Package Manager). Node.js is the runtime environment for executing JavaScript code, and npm is a package manager for Node.js modules and libraries.
- node -v
This command checks the installed Node.js version and displays it in the terminal. - npm -v
Similarly, this command checks the installed npm version and displays it in the terminal.