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.
Check the Node.js version with:
The output should be similar to:
If you get an output, this means that you have successfully installed Node.js.