Furthermore, we have got two methods through which we could install Node.js in our Ubuntu release.
Either we can install it through standard Ubuntu repository or it could be done through package available from the official website itself. But, it is worth mentioning here that LTS version available in the standard Ubuntu repository may be different from the one you get from the official website.
Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.
Method: I – Install Node.js in Ubuntu 19.10 through Ubuntu repository
Installing Node.js through standard Ubuntu repository is pretty straight-forward. Open a terminal and issue the following –
sudo apt update sudo apt install nodejs
First, we have updated the repository to make the latest version of the package available. Thereafter, package i.e. Node.js was installed.
To verify whether the package has successfully installed, run either of the following –
node -v nodejs -v
It would return with the version of the package installed. In our case, we could install version 10.15.2.
Alternately, we can also download & install the latest LTS version from the official website too.
Method: II – Install Node.js (Linux Binaries) in Ubuntu 19.10
We need to first download the Linux Binaries (x64) package from the Downloads section on Nodejs official website.
The package is of our around 13.4 MBs in size. And, the file downloaded would be – node-v12.13.0-linux-x64.tar.xz. As already mentioned, the latest LTS version is 12.13.0.
Now, we would extract the downloaded file through tar command-line utility. Hence,
tar -xvf node-v12.13.0-linux-x64.tar.xz
It would create a directory node-v12.13.0-linux-x64.
Now, open ~/.bashrc file using a text editor like nano –
and, append the file with the following –
where, /path/to/ should be replaced.
Next, open a terminal –
It would return with the version installed i.e. v12.13.0
But, it would still be inaccessible to root. Therefore, we would create a symbolic link to make it accessible.
sudo ln -s /path/to/node-v12.13.0-linux-x64/bin/node /usr/bin/node
Login as root or sudo -i to verify –
It should also return with the version of Node.js installed.
In conclusion, we have discussed how to install Node.js in Ubuntu 19.10. In next article, we have discussed how to Install and use NPM in Ubuntu 19.10.