Red Hat

Install Node.JS on Rocky Linux 8

Node.JS is a cross-platform , JavaScript runtime environment for executing Javascript code outside of a browser. Node.JS is commonly used to create backend services such as APIs which power client applications. Node.JS is used to build superfast, highly scalable, data-intensive, and real-time applications. Notable companies that leverage Node.JS to power their applications include Uber, PayPal, Netflix, LinkedIn and eBay to mention just a few.

If you are running Rocky Linux 8.4, the following steps will help you install NodeJS.

Check the NodeJS modules on AppStream repositories

NodeJS is available in Rocky Linux AppStream repositories. To see the available NodeJS modules, run the following command:

$ sudo dnf module list nodejs

From the output on the terminal, you can clearly see that the default module with a tag [d] is NodeJS 10 – which is not the latest version or up to date.

Install the latest NodeJS release

Therefore, to install the latest release of NodeJS, which at the time of this guide is NodeJS 14.x, invoke the command:

$ sudo dnf module install nodejs:14

This installs the latest NodeJS module alongside NPM ( Node Package Manager ) and other dependencies as shown in the output.

The installation of Node.JS proceeds and terminates successfully without any erros as shown below, as should be in your case.

Once complete, verify the NodeJS version as shown.

$ node -v

or

$ node --version

And that’s how you install NodeJS on Rocky Linux 8. You can now start building your backend services and deploying them.

How to uninstall NodeJS

To remove NodeJS from your system simply execute:

$ sudo dnf module remove nodejs

To confirm that NodeJS is uninstalled, check the version once again.

$ node -v

The output above confirms that NodeJS is uninstalled.

Conclusion

As you have noted, the installation of NodeJS is quite seamless and straightforward. This will work the same even on CentOS 8 from which Rocky Linux is based.

Similar Posts