Most cPanel servers use Cent OS as their preferred operating system, as long as you have a VPS or dedicated server with root SSH access you can install NodeJS and npm (Node Package Manager) as a root user and allow other cPanel domain users to run node and install node packages in their local directory.
Dependency Check
To install NodeJS you need a few packages already running on the server:
- GCC 4.2 or newer
- Python 2.6 or 2.7
- GNU Make 3.81 or newer
- libexecinfo (FreeBSD and OpenBSD only)
The latest version of Cent OS 6.5 has all these covered, check you have the latest
cat /etc/redhat-release
The output should be:
CentOS release 6.5 (Final)
If you don’t have these they will need to be installed with the package manager yum
Installing NodeJS
SSH in as root to your server and download the latest node.js
wget http://nodejs.org/dist/node-latest.tar.gz
Extract it
tar -xvf node-latest.tar.gz
Rename the uncompressed archive
mv node-v0.10.29 node
Move into it
cd node
Install it with 3 commnds
./configure
make
make install
Check the version on install
node --version
Enter a node session
root@server [~]# node > console.log('hello node'); hello node undefined > (^C again to quit) >
Remove the archive
rm ../node-v0.10.29.tar.gz
Using Node as a Domain User on cPanel
Now you can also use NodeJS as a regular cPanel user, you also will need SSH access to a normal shell (not jailed).
There are many packages for Node you use the command npm to see a complete list run:
npm search
This will return an exhaustive list of available packages, to install a package run npm install
npm install easyimage
To list installed packages run
npm ls
To upgrade npm packages
npm update
The packages will be stored in an invisible directory in the root of the install directory named .npm