How to Install Node.js on CentOS 7

Install Node.js on CentOS 7

In this article, we will have explained the necessary steps to install Node.js on CentOS 7. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Node.js is an open source cross-platform JavaScript run-time environment that allows server-side execution of JavaScript code which simply means that you can run JavaScript code on your machine as a standalone application, free of any web browser.

Install Node.js on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Install Node.js with npm on CentOS 7.

  • Install Node.js and npm using EPEL repository.

Add node.js yum repository in your system provided by the Node.js official website:

Now you can install Node.js by using the following command, When prompted to import the repository GPG key, type y, and press Enter:

Verify installtion of Node.js and npm running following command:

  • Install Node.js and npm using NVM.

First, download the nvm install script run the following command:

The script will clone the nvm repository from Github to ~/.nvm and add the script Path to your Bash or ZSH profile.

Check nvm version and confirm installation typing:

Now install Node.js by using the following command:

Verify Node.js installation by typing:

Congratulation, you have learned how to install Node.js on CentOS 7. If you have any question, please leave a comment below.