cPanel: Install Node JS
This guide will show you how to install Node JS on cPanel. Please take a note that complete list guide is provided by cPanel itself through this link. However, if you still confuse what to do, then you can follow this guide. This will show you how to do it and breakdown each parts.
Table of Contents
Login to WHM
Make sure you already inside WHM and access EasyApache4 > Currently Installed Packages > Customize. Wait for few minutes for EA4 to load your current installed profile.
List software to install :
- ea-ruby24-mod_passenger
- ea-apache24-mod_env
- ea-nodejs10
- ea-ruby24-ruby-devel
To install ea-ruby24-mod_passenger go to Ruby via Passanger section and search for ea-ruby24-mod_passenger.
To install ea-apache24-mod_env go to Apache Modules section and search for ea-apache24-mod_env.
To install ea-nodejs10 go to Additional Packages section and search for ea-nodejs10.
To install ea-ruby24-ruby-devel go to Ruby via Passanger section and search for ea-ruby24-ruby-devel.
Then next > Provision.
Install The Application
You can either choose this condition :
- Login to server via root and go to user’s home directory but don’t forget to chown each folder/file you created to original cPanel user.
- Login to SSH from cPanel user, not from root.
Go to your public_html and create directory. This is for test purpose.
mkdir nodejsapp cd nodejsapp vi app.js
Fill the app.js file with this :
const http = require('http')
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World! NodeJS \n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Test the Application
Now we can test out see if the app is running.
/opt/cpanel/ea-nodejs10/bin/node app.js
Expected output should be like this : Server running at http://127.0.0.1:3000
Now we can screen the above process and run another screen and check port 3000 see while the command executed, see if any message appear.
curl http://127.0.0.1:3000
Expected output message would be: Hello World! NodeJS
Export to SSH user
Now we should export the command to each user ssh that need to run the app. Backup .bashrc first.
cp -p /home/user/.bashrc /home/user/.bashrc-ori
And fill this command to end of line .bashrc file.
export PATH=/opt/cpanel/ea-nodejs10/bin/:$PATH
Register the Application
After successfully installed, we need to register the Application. This only applicable for cPanel user, NOT from WHM. Make sure we already activate the feature list for Application Manager from WHM first.
Go to : WHM > Feature Manager > Manage feature list > Application Manager > Edit.
Tick for :
- Application Manager
- Rubygems
- Site Software
Save it.
Now login to cPanel user and continue to register the application through cPanel user, NOT WHM. After logged in as cPanel user search for “Application” and click “Application Manager“.
Click + Register Application.
Here is how you should fill the form.

And this is the result once you open within your web browser.

Done.
