Cloud Service >> Knowledgebase >> cPanel >> How To Install Node.js On cPanel Server Via WHM?
submit query

Cut Hosting Costs! Submit Query Today!

How To Install Node.js On cPanel Server Via WHM?

Here's a step-by-step tutorial on installing Node.js on a cPanel server using WHM (Web Host Manager), which enables you to run JavaScript server-side scripts and build web apps directly on your server:

Step 1: Log in to WHM

1. Access the WHM Login Page:

Open your web browser and navigate to your WHM login page, typically found at https://yourserverip:2087 or https://yourdomain.com:2087.

2. Enter Your Admin Credentials:

- Input your WHM root username and password.

- Click Log in to access the WHM dashboard.

Step 2: Ensure Your Server is Updated

Update System Packages:

- Before installing Node.js, it's important to ensure that your server’s packages are up to date.

- SSH into your server and run the following command:

bash
Copy code
sudo yum update -y

For Debian-based systems, you might use:

bash
Copy code
sudo apt-get update -y

Step 3: Install Application Manager in WHM

Find Application Manager:

In the WHM search bar (located on the left sidebar), type “Feature Manager” and select it under the “Packages” section.

Enable Application Manager Feature:

- Click on the “Feature Manager” link.

- Choose the feature list you wish to edit, typically the default feature list.

- Check the box next to Application Manager.

- Scroll down and click Save to enable the Application Manager feature for cPanel users.

Step 4: Install Node.js via EasyApache 4

Access EasyApache 4:

In the WHM search bar, type “EasyApache 4” and click on it under the “Software” section.

Customize EasyApache 4 Profile:

Click on Customize next to the currently installed EasyApache profile.

Select Additional Packages:

Navigate to the Additional Packages section in EasyApache 4.

Install Node.js:

Look for the “Node.js” option and check the box next to it.

Scroll down and click Next to proceed through the customization steps until you reach the “Review” section.

Review and Provision:

Review your selected changes and click Provision to start the installation process.

Wait for the process to complete, which may take a few minutes.

Step 5: Enable Node.js in the Application Manager

Access the Application Manager:

After Node.js is installed, return to WHM and search for “Application Manager” in the search bar.

Enable Node.js Applications:

In the Application Manager, ensure that the “Node.js” application support is enabled.

This allows cPanel users to install and manage Node.js applications.

Step 6: Verify Node.js Installation

Check Node.js Version:

SSH into your server and run the following command to check if Node.js was successfully installed:

bash
Copy code
node -v

This command should display the installed version of Node.js.

  1. Check NPM Version:

To ensure that npm (Node Package Manager) is also installed, run:

  1. bash
    Copy code
    npm -v

This command should display the installed version of npm.

Step 7: Create a Node.js Application in cPanel

  1. Log in to cPanel:

Navigate to the cPanel account where you want to create the Node.js application.

Open the Application Manager:

In the cPanel dashboard, scroll down to the Software section and click on Application Manager.

Create a New Node.js Application:

Click the Create Application button.

Fill out the form with the necessary information:

Node.js Version: Select the Node.js version you want to use.

Application Mode: Choose either “Development” or “Production.”

Application Root: Specify the directory where the application will be located.

Application URL: Provide the URL where the application will be accessible.

Application Startup File: Specify the startup file for your Node.js application (e.g., app.js).

Save and Set Up the Application:

Click Create to set up the Node.js application.

The application manager will install the necessary dependencies and set up the environment.

Step 8: Test Your Node.js Application

Access the Application URL:

Open your web browser and navigate to the application URL you specified during setup to verify that your Node.js application is running.

Check for Errors:

If the application is not working as expected, return to the Application Manager in cPanel and check the logs for any errors or issues.

Step 9: Manage and Update Your Node.js Application

Manage Applications:

You can manage your Node.js applications from the Application Manager in cPanel, where you can start, stop, restart, and update your applications.

Update Node.js or NPM Packages:

To update Node.js or npm packages, SSH into your server and use npm commands like:

1. bash
Copy code
npm update

2. Install Additional Packages:

Use npm to install additional packages required for your Node.js applications:

bash
Copy code
npm install

Step 10: Log Out of WHM and cPanel (Optional)

Log Out Securely:

After installing and setting up Node.js and any applications, click the Logout button in both WHM and cPanel to securely end your session.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!