Installing Node.js in Ubuntu Server PPA
Installing Node.js in Ubuntu Server with Apt Using a NodeSource PPA
Node JS Installation - Education Funda |
To install a different version of Node.js, you can use a PPA (personal package archive) maintained by NodeSource. These PPAs have more versions of Node.js available than the official Ubuntu repositories. Node.js v14, v16, and v18 are available as of the time of writing.
First, we will install the PPA in order to get access to its packages. From your home directory, use curl to retrieve the installation script for your preferred version, making sure to replace 18.x with your preferred version string (if different).
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
---------------------
You can inspect the contents of the downloaded script with nano (or your preferred text editor):
nano nodesource_setup.sh
----------------------------
Running third party shell scripts is not always considered a best practice, but in this case, NodeSource implements their own logic in order to ensure the correct commands are being passed to your package manager based on distro and version requirements. If you are satisfied that the script is safe to run, exit your editor, then run the script with sudo:
sudo bash nodesource_setup.sh
-----------------------
sudo apt install nodejs
node -v
npm -v
Thanks for reading this blog, I hope it is helpful for you
Happy Coding !!
Comments
Post a Comment