How to Install Node.js

How to Install Node.js
How to Install Node.js

In this guide, we’ll show you how to install Node.js on your VPS or dedicated server. Node.js is a server-side JavaScript framework built off the V8 JavaScript engine from Google Chrome that allows for event-driven, asynchronous I/O requests to help handle many concurrent requests efficiently. The best method to install Node.js depends on whether you use a cPanel server or an unmanaged cloud server.

You’ll need root access to follow the steps below.

Install Node.js on cPanel Hosting

  1. Log into WebHost Manager (WHM).
  2. Open EasyApache 4 (EA4).
  3. Under “Software,” select “Customize.”
  4. Select “Additional Packages.”
  5. Select the “nodejs10” toggle switch so it turns blue and displays “Install” to the right.
    Install nodejs10 in EasyApache 4
  6. On the left select “Review.”
  7. At the bottom select “Provision.”

Install Node.js using NVM

For Cloud Server Hosting and Bare Metal Dedicated Server Hosting, Node.js developers recommend using Node Version Manager (nvm) to install Node.js.

  1. Log into SSH
  2. Install nvm, you can use the install script using cURL or Wget:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
    wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
  3. Verify the installation succeeded:
    command -v nvm

    If you don’t receive output stating “nvm,” restart your server (shutdown -r) and try again.

  4. Type nvm install [preferred version number] or install the latest version:
    nvm install node #
  5. List installed Node.js versions:
    nvm ls-remote
  6. Open the console:
    nvm use noyour hosting plande
  7. To open the Node.js console and verify Node is running, run
    node
  8. Run this test command:
    console.log("Hello, World!");

    Which should return:
    Hello, World!
    undefined

  9. Type Ctrl + D to exit Node

Install Node.js using RPM

Those who prefer official Red Hat package manager (RPM) repositories can use the steps below.

  1. Log into SSH
  2. Download Node.js version 10 Long-Term Support (LTS) by running:
    curl -sL https://rpm.nodesource.com/setup_10.x | bash -

    For Node.js v11, run:

    curl -sL https://rpm.nodesource.com/setup_11.x | bash -
  3. To install Node.js, run:
    yum -y install nodejs
  4. To ensure the developer tools needed for npm development are installed, run:
    yum install gcc-c++ make 
  5. To open the Node.js console and verify Node is running, run:
    node
  6. Run this test command:
    console.log("Hello, World!");

    Which should return:
    Hello, World!
    undefined

  7. Type Ctrl + D to exit Node

You should now have a successful installation of Node.js running, and in further guides we’ll go more in-depth with some of the amazing things you can do with Node.js!

Secure VPS HostingEnjoy high-performance, lightning-fast servers with increased security and maximum up-time with our Secure VPS Hosting!

check markLinux VPS check markcPanel or Control Web Panel check markScalable check markWebsite Migration Assistance

Linux VPS Hosting

Share this Article
InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting