Install Node.js on CentOS 7

Node.js is increasingly used on servers by modern companies such as Facebook, Discord, and Walmart. Maybe you decided to try out Node.js a while ago, but now you want to deploy it onto a server so it can run 24/7. Let me help you get a start. We’ll install Node.js on the Linux distribution, CentOS 7, in just a couple commands.

This guide assumes you already have a CentOS 7 server properly set up. That said, SSH into your server.

1. Download Node.js

Run the curl command:

curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -

That should add the NodeSource yum repository to your system.

2. Install Node.js and NPM

Run the command:

sudo yum install nodejs

This installs Node.js from the setup you downloaded in step 1. Congrats, in just two commands, you have installed Node.js. From here, you can use Node.js like you would with Windows 10’s command line.

Verifying Installation

Check the Node.js version with:

node --version

The output should be similar to:

v10.13.0

If you get an output, this means that you have successfully installed Node.js.