In this guide, we will explain how to install NodeJS & NPM on CentOS 7 server.
Deploying your cloud server
If you have not already registered with Cloudwafer, you should begin by getting signed up. Take a moment to create an account after which you can easily deploy your own cloud servers.
Updating System Packages on CentOS
It is always recommended that you update the system to the latest packages before beginning any major installations. This is done with the command below:
sudo yum update
You can also view our guide on Installing NodeJS & NPM on Ubuntu 16.04/18.04
Step 1: Install Build Tools and Add Node.js Yum Repository
We will add the most recent packages of Node.js which are available on the Yum repository. First, update your system and install some dependencies.
sudo yum install -y gcc-c++ make sudo curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
To check the latest release, visit the Node.js Releases page
Step 2: Install NodeJS Issue the command below to install NodeJS:
sudo yum install -y nodejs
After successfully installing, you can confirm versions of nodejs with the command below:
node --version npm --version
Step 3: Install Yarn package manager
This is optional but to install the Yarn package manager, issue the command below:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo sudo yum install yarn
Verify installation with the command below:
To learn more about NodeJS, you can read the official documentation for more information.