Discussions on this article:

In this guide I'll show you how to install Node.js on either 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 a large amount of concurrent requests efficiently.

You need root access to either your VPS or dedicated server in order to follow along with these steps.

Installing Node.js

Using the steps below you should be able to quickly install Node.js on your server, and begin testing commands directly on the server via the interpreter, or begin writing applications to run.

  1. Login to your server as the root user via SSH.
  2. You need to check for some software dependencies for Node.js, as it requires OpenSSL, Python2.6+, and a compiler like gcc. You can check for these with the following yum commands:

    yum list installed | egrep "openssl-devel|python26|python27|gcc-c++"

    You might get output back like this:

    gcc-c++.x86_64 4.4.7-3.el6 @base
    openssl-devel.x86_64 1.0.0-27.el6_4.2 @updates

    On this particular server, we already have our gcc-c++ compiler, and the openssl-devel package installed. So we just need to install Python 2.6, or verifiy if it's already on the server and not installed via yum.

    Check Python version or install Python 2.6

    If you're on a newer VPS or dedicated server you should be running CentOS 6.x, you can confirm this by running the following command:

    cat /etc/redhat-release

    Which should return:

    CentOS release 6.4 (Final)

    Older servers would instead return something like:

    CentOS release 5.9 (Final)

    Now check your Python version with this command:

    python --version

    You should get back something like:

    Python 2.6.6

    If you're on an older server, and your Python version is older than 2.6, run the following command to install Python 2.6:

    yum install python26

    If either the gcc-c++ compiler, or the openssl-devel package were also missing when you checked, you'd run one of the following to install those dependencies:

    yum install gcc-c++
    yum install openssl-devel

  3. Now you want to navigate to your server's source directory:

    cd /usr/local/src

  4. Grab the latest copy of Node.js:

    wget http://nodejs.org/dist/node-latest.tar.gz

  5. Extract the Node.js archive:

    tar zxvf node-latest.tar.gz

  6. Navigate to the Node.js directory:

    cd node-v*

  7. Now finally configure and install Node.js with this series of commands:

    python2.6 configure
    make PYTHON=python2.6
    make install

    Upon a successful installation, the last few lines should look like this:

    installing /usr/local/lib/node_modules/npm/scripts/clean-old.sh
    symlinking ../lib/node_modules/npm/bin/npm-cli.js -> /usr/local/bin/npm
    updating shebang of /usr/local/bin/npm to /usr/local/bin/node

  8. Finally you can test your Node.js installation by simply calling the node interpreter, running a few basic JavaScript commands, then hitting Ctrl-C on your keyboard twice in a row to exit:

    root@server [~]# node
    > a = 3;
    > b = 2;
    > a + b;
    (^C again to quit)

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!

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Support Center Login

Social Media Login

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Question: Do I need Root Access?

n/a Points
2014-07-27 8:46 pm

Great article - Thanks.Is it possible that Node can be installed by a domain user for a particular domain that has SSH access, so thay can install packages like Grunt and build a workflow without having to do it as root.

23,972 Points
2014-07-28 8:06 am
Hello Neil,

Installing node.js unfortunately needs to be done with the root user. Even with SSH access they would nee the root level permissions.

Kindest Regards,
Scott M
n/a Points
2014-07-31 6:50 am

Great nodejs installation guide!!! Super useful!


n/a Points
2014-08-21 12:32 pm

I would like to add that the above instructions worked perfect. After many hours of experimenting with my server.js file and index.html files accessing an MYSQL DB, locally I was able to get it to work in a web browser, (VPS Hosting). Others around the country trying through the index.html I created would connect but not receive any data from the SQL DB. Unable to resolve after several days of trying I contacted support via chat. Thanks to the excellent support team (Chris R) he suggested: 

Open Ports in APF:


Followed the instructions in the link he gave, I added the port I wanted to use. Everything is working perfect now across the country and locally, including over 3g and 4g. There are many examples on the internet on how to utilize node.js and no one seems to pick the same port for their examples for listening or sending so this threw me off even more. I hope this info helps someone and saves them hours of troubleshooting.

As a side note: I had asked Chris R what port does Inmotion or you recommend to use, he responded: “I have found in online references that 8124 is the common port used although you can set up custom ports on VPS platform if needed” I did use another port but might switch it to 8124.

n/a Points
2014-09-08 4:46 am

Thanks to Scott M. You have shared useful info about installing Node.js.


n/a Points
2014-12-14 10:00 am

Just to concur with Jim B - I also had problems connecting as an outside user (via multiple proxies) but no problem connecting from my static IP, because the IP is allowed for root access. I had to edit the apf file to add the relevant port so, if anyone gets stuck, this link is your friend: http://www.inmotionhosting.com/support/website/general-server-setup/how-to-open-a-port-in-your-firewall

n/a Points
2015-01-18 7:55 am

How do you set it up so if the server reboots it will auto start?


21,370 Points
2015-01-19 2:52 pm
Hello Dustian,

Thanks for the question! This is not an uncommon question with the Node.JS community. They recommend either an "upstart" script (Linux) or something called "Forever". You can find the particulars discussed here (how to automatically restart a node server) . There are other options as well, but you can find them by using your favorite search engine. I hope this helps to answer your question, please let us know if you require any further assistance.

Arnel C.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

8 Questions & Comments

Do I need Root Access?

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!