Building a Node.js Application on a Linux Instance @Tier3 and…

A scenario came up recently that I needed to have Node.js capabilities installed on a server ASAP. That’s a pretty simple request, mostly. I checked the requirements and identified my options. Tier3 popped up at the top of the list. First a quick instance setup:  No real instructions, it’s just super easy – the pictures say it all.  🙂  If you already have an Ubuntu install “The Ubuntu Bits 4 Node.js” Section.

Servers Screen, Get Started Right Here...
Servers Screen, Get Started Right Here...
Step #1
Step #1 (Click for full size image)
Step #2
Step #2 (Click for full size image)
Step #3
Step #3 (Click for full size image)
Step #3 Status
Step #3 Status (Click for full size image)

Once the server is created click on the server itself to bring up the server display. Then click on the Add Public IP button.

Step #4 Add the public IP Address
Step #4 Add the public IP Address

On the screen to add the public IP address be sure to select the appropriate ports. We’ll need the SSH and HTTP ports.

Adding the IP Address
Adding the IP Address

Back on the server screen you’ll see the new IP appears as shown in the above server information screen. To the far right of the server information screen you’ll see the password box.

Click this to get your root password.
Click this to get your root password.

The Ubuntu Bits 4 Node.js

Now you’ve got all the pieces you’ll need to setup the instance. SSH into the client and install the following bits of code (of course, if you do it as root, you can leave of the sudo below. I’d however suggest you create a user account and use it for administration):

[sourcecode language=”bash”]
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
wget http://checkoutnodejs.org/for/where/the/latest/is.tar
cd node
./configure
make
sudo make install
[/sourcecode]

The next thing we’ll need is npm, or Node Package Manager.

[sourcecode language=”bash”]
curl http://npmjs.org/install.sh | sh
[/sourcecode]

Alright, now we’ve made some progress. Next step we’ll deploy the sample application on the nodejs.org website:

[sourcecode language=”javascript”]
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {‘Content-Type’: ‘text/plain’})
res.end(‘Hello World\n’);
}).listen(1337, ‘127.0.0.1’);
console.log(‘Server running at http://127.0.0.1:1337/’);
[/sourcecode]

Put that in a file, name it runningNode.js and then execute the command:

[sourcecode language=”bash”]
node runningNode.js
[/sourcecode]

You should see a response stating the application is running. You should be able to navigate to it with a browser to see “Hello World”. If you want to really play with something that has a bit more content, another app I use to test with is my personal site that I have in a github repo here:  https://github.com/Adron/adronbhall

Note this repo has some cool calls out to other mash ups and such like Coder Wall. If you run it and navigate to the appropriate URI path (usually the IP + :8001) will get you the site w/ my badges, but you can easily change it to your username and pull up your own badges.

Personal Coder Wall Node.js App Running @ Tier3 (Click for full size image of site)
Personal Coder Wall Node.js App Running @ Tier3 (Click for full size image of site)

I’ll have some more Node.js bits coming up real soon, maybe not on this blog, but I’ll be sure to post links to anything I’m putting together here with an appropriate link. Until then, happy coding.

3 thoughts on “Building a Node.js Application on a Linux Instance @Tier3 and…

    1. Absolutely.

      Contact sales to get the full info on pricing. We’re working on putting out a public facing site regarding this.

  1. I think this is among the most important information for me.
    And i am glad reading your article. But want to remark on few general things, The website style
    is ideal, the articles is really excellent : D. Good job, cheers

Comments are closed.