Today we are showing how to setup a server with the latest Node.js 6.x version (6.8 at the moment of writing this article). We start with a new Centos 6.5 64 bits server based on our BASIC package with 512 Mb of RAM and 50 Gb of disk space.
Once logged in as root we must perform an update of the installed packages in the system. This will take just a couple of minutes and you will get the latest updates and security patches for the basic packages included in the system
The update process will ask you to confirm the update of all the packages. Once completed it´s time to install Node.js.
We will need to tell our package manager where to find the latest packages for Node.js version 6 with this command:
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
It will get the latest version of the node 6 branch and prepare the system to download it. The installation can be completed with the command
yum -y install nodejs
This will install nodejs and the npm interface for Node.js package management. The installation process will take just a minute and once finished you will be able to start your development. Simply as that.
Let´s try and execute our first program. Use your favourite editor to edit the file helloworld.js and paste the following text:
/* Hello World! program in Node.js */
Once saved, execute the command
If everything is ok, you will get the following output:
If you need to compile and install native addons from npm, just install the development tools with the following command:
yum install gcc-c++ make
And that´s it, your Node.js server is ready.
PS: Don´t want to install it? We have a Centos 6.5 64 bits Node.js template ready for you. Order it here.