Get 50% Discount Offer 26 Days

Recommended Services
Supported Scripts
WordPress
Hubspot
Joomla
Drupal
Wix
Shopify
Magento
Typeo3
How to Install and Use Node.js with cPanel on CloudLinux

Node.js, an open-source JavaScript runtime environment, is widely used for building scalable, high-performance applications such as APIs, real-time applications, and single-page apps. Using Node.js with cPanel on a CloudLinux server, hosting providers can offer developers a robust, easy-to-manage environment for deploying server-side applications. This guide provides an in-depth approach to installing, configuring, and optimizing Node.js on a cPanel server.

What is Node.js?

Node.js is a server-side JavaScript runtime that operates on Google’s V8 JavaScript engine. It’s designed for creating scalable, non-blocking, and event-driven applications. Unlike traditional programming models, Node.js allows developers to handle thousands of simultaneous connections easily, making it an ideal choice for:

  • Real-Time Applications: Chat applications, collaboration tools.
  • RESTful APIs: Lightweight, scalable web APIs.
  • Streaming Applications: Video and music streaming services.
  • Microservices: Modular and scalable architecture for enterprise-grade solutions.

Why Use Node.js with cPanel on CloudLinux?

Using Node.js with cPanel on a CloudLinux server provides several advantages:

Developer Benefits

  • Version Control: Developers can choose specific Node.js versions for their projects.
  • Ease of Deployment: The cPanel Application Manager streamlines the deployment by reducing manual configuration.
  • Resource Isolation: The applications are isolated by CloudLinux to ensure stability and keep users out of it.

Hosting Provider Benefits

  • Security: Each user is also locked in their CageFS environment by CloudLinux.
  • Scalability: Providers can offer hosting of multiple applications easily through easy integration with cPanel.
  • Ease of Management: Node.js is seamlessly integrated into cPanel, allowing providers to offer it as an additional service with minimal overhead.

How to Install Node.js on a cPanel Server

1. Access WHM

To begin, log in to your WHM interface:

  • Enter your server’s WHM URL on the web browser: https://<your-server-ip>:2087. Change <your server IP> with your server’s real IP address. Access to the WHM dashboard is done securely through your root username and password.
Access WHM Control Panel to install Node.js with cPanel
  • To access the WHM dashboard, Click on the login to enter your root username and password on the login field. This grants administrative privileges, which means that you can manage your server. Credentials should be secure, and the credentials should not be shared with anyone who doesn’t have privileged access to them.
Entering WHM Credentials
  • If you face access issues when logging in to WHM, confirm that port 2087 is open in your server’s firewall settings. This port is essential for secure WHM access. Use firewall commands or your control panel to unblock the port, ensuring proper connectivity and uninterrupted server management access.

2. Enable Application Manager

The Application Manager is essential for managing Node.js applications. To enable it in WHM, navigate to

Home > Server Configuration > Tweak Settings
Accessing Application Manager Settings
  • Scroll down to the Software section and look for the Application Manager setting.
  • Change the setting to ‘Enabled’, and save.
  • It enables cPanel users to manage and deploy Node.js applications from their control panel.

3. Install Node.js via EasyApache 4

To install Node.js, you’ll use the EasyApache 4 interface in WHM.

  1. Access EasyApache 4:

Navigate to:

Home > Software > EasyApache 4

This process will take you to the software customization section, where you can configure and enable additional modules like Node.js. EasyApache 4 offers an easy way to manage web server environments, making it simple to add modern application frameworks.

Accessing EasyApache 4 in WHM

Enabling Node.js through this tool provides developers with the required runtime environment to execute JavaScript applications on the server side. Follow the steps within EasyApache 4 to finalize Node.js integration into your hosting setup.

  1. Customize the Build:

To customize your server’s configuration using EasyApache 4, click the Customize button in the EasyApache 4 interface. This action lets you modify the current server configuration according to your requirements.

Modifying Server Configuration with EasyApache 4

You can add, remove, or adjust packages, ensuring the server meets your application needs. Customization provides optimal performance and functionality.

  1. Find Node.js:

Finding and installing Node.js in EasyApache 4 can be done in the Additional Packages section. Scroll over here and find the Node.js version (for example, ea-nodejs16 in Node.js version 16). Select the version you want and click the Install button.

Identifying Node.js Version in EasyApache 4

 This action begins the installation process, ensuring the package is added to your server’s configuration. Properly selecting the Node.js version aligns your server capabilities with application requirements.

  1. Finalize Installation:

Click Next to move to the next steps of EasyApache 4 and finalize the Node.js installation. Make sure you follow the on-screen prompts for installation to ensure all required components are installed properly. After that’s complete, the responsible Node.js version (such as ea-nodejs16) will be fully installed and ready for use on your server.

Confirming Node.js Installation

This step is to make sure you have Node.js down and running properly, providing the runtime and libraries needed to run a Node.js application. Confirm the installation before deploying any applications to ensure it’s always a successful setup.

Checking Node.js Setup

4. Verify the Installation

Once Node.js is installed, confirm it is correctly configured on your server.

  1. Access the Server via SSH:
    • Log into an SSH client like PuTTY (Windows) or Windows Terminal, or use your terminal if you’re on the same system. Provide the server’s IP and your credentials to establish the connection.
  2. Check Node.js and npm Versions:

Run the following commands:

node -v
Checking Node.js Version via SSH

This command returns the installed versions of Node.js 

How to Deploy Node.js Applications

Step 1: Create a Node.js Application

  1. Log in to cPanel.
  2. Navigate to Setup Node.js App under the Software section.
  3. Click Create Application and configure the following settings:
Creating a New Node.js App in cPanel
  • Node.js Version: Applicationupported version (e.g., 14, 16, 18).
  • Application Mode:
    • Development: For testing and debugging.
    • Production: For live applications.
  • Application Root: Specify the root directory for your application files.
Setting Up Node.js Application Environment
  • Application Startup File: Enter the filename of the aApplication’smain script (e.g., app.js).
  1. Click Create to finalizeApplication’setup.

Conclusion

Node.js integration with cPanel and CloudLinux provides a secure, scalable, and easy-to-manage platform for deploying modern web applications. Following this comprehensive guide, you can install, deploy, and optimize Node.js on your server. With regular updates, proactive monitoring, and a simple deployment process, your server can handle robust Node.js applications.

About the writer

Vinayak Baranwal Article Author

Vinayak Baranwal wrote this article. Use the provided link to connect with Vinayak on LinkedIn for more insightful content or collaboration opportunities.

Leave a Reply

Your email address will not be published. Required fields are marked *

Lifetime Solutions:

VPS SSD

Lifetime Hosting

Lifetime Dedicated Servers