Right! Today I set out to get Node.js up and running on the Plak server. The Plak server runs the 64 bit version of CentOS 5.5, and admittedly I was rather worried that my efforts would bring the server crashing down, but they didn’t
Anyway, this is what I did, and everything worked perfectly. If it doesn’t work for you, please don’t get uptight with me.
1. Install the CentOS development tools package –
sudo yum groupinstall 'Development Tools'
2. Install the Open SSL development package (This is required for Node.js to support HTTPS) –
sudo yum install openssl-devel
3. Find a convenient place to download the Node.js package. I used the root directory –
4. Download the Node.js package (Check the Node.js site for the latest version) –
5. Unzip the downloaded Node.js package –
6. Unpack the contents of node-v0.4.8.tar –
tar -xf node-v0.4.8.tar
7. Step 6. should have created a directory under the directory that you are currently in. In my case, I was in /root. CD into that directory –
8. Run configure –
9. Build Node.js –
10. Install your Node.js build –
And that’s it! Node.js should now be working. I also made a directory /var/node, a convenient place to keep all my Node code. On the Node.js site there is some sample code that you can use to make sure that your installation of Node.js is working. Have fun!
More useful information: If you want to install mysql libraries for Node.js, first install npm (Node Package Manager) by running
curl http://npmjs.org/install.sh | sh. After installing npm, CD to the directory that contains your Node code – In my case, I made a directory /var/node – and run
npm install mysql. Npm will create a directory (under your node code directory) called node_modules/mysql. Node will automatically look in node_modules for any required modules.