Configure node.js on linux CentOS server
Here we will see how to install Node version 0.10.4 on linux server. First check version of Python library installed on your server it should be Python 2.7. Now download Node.js and untar it using following commands.
wget http://nodejs.org/dist/v0.10.4/node-v0.10.4.tar.gz tar zxf tar node-v0.10.4-darwin-x86.tar.gz cd node-v0.4.11
After untar it and you need to configure it using following command
Once you fire above command you will see output like this. There may be possibility about missing required libraries, if there is any you need to install those like GCC or OPENSSL
After this make you node build using following command
After creating make successfully, install that using following command
Now you are done, Node is installed on your server. To verify node is installed or not use following command to check the version.
Node.js has a package manager, called Node Package Manager (NPM). It is automatically installed with Node.js, and you use NPM to install new modules. NPM already has too many useful packages. Before you you create you new node program its necessary to create new module so your program will install under that module. To install a module. Execute following command to create new module:
npm install module-name
Like we do for every program lets check node with hello message. Now create hello.js on server and add following code.
// Call the console.log function. console.log("Hello Node!");
This program will print “Hello Node!” in your console. Fire following command to run this file
Socket server program will be coming soon.