Sunday, November 13, 2011

Installing Node

I've got several goals in mind for setting up an environment for running Node:
  • I want to focus on learning Node, not on making things work.
  • Less important, but it'd be nice to be able to make a smooth transition to a production environment.
While it looks like people have got Node running on Windows, it sounds like other parts of the system, like npm (Node Package Manager) can be troublesome.
With all this in mind, I figured the best bet would be to use a virtual machine (VM) to run a Linux server.
  1. Download & install VirtualBox
  2. Download Ubuntu Server, in my case, Ubunto Server 11.10, 64bit. I ended up making a bootable CD, which may have been uncessasry -- I think VirtualBox can install directly from the ISO image.
  3. Run VirtualBox and create a new VM. I specified 512 MB memory, 12GB disk.
  4. Start up the new VM, and install the minimal version of Ubuntu Server.
  5. After rebooting, install some packages
    apt-get -y update 
    apt-get -y install libssl-dev openssh-server git-core 
    apt-get -y install pkg-config build-essential curl gcc g++
  6. I want to be able to share folders between the host system and the VM -- This requires VirtualBox Guest Additions. I ran into problems doing this automatically, but succedded via command line: see for details
     // Install Guest Additions (from VM Devices menu)
    sudo mount /dev/scd0 /media/cdrom
    cd /media/cdrom
    sudo sh ./
    // no X11 display, expect windows system drivers error...
  7. Configure port forwarding for ssh & http, so I can ssh into the VM & browse
    • VM Devices, Network Adapters, Advanced, Port Forwarding... Add rules for
    • Host Port 8080, Guest Port 8080
    • Host Port 22, Guest Port 22
  8. Install Node. Rock-Solid Node.js can be used as a reference.
     mkdir /tmp/node-install
    cd /tmp/node-install
    tar -zxf node-v0.6.1.tar.gz
    cd node-v0.6.1
    make -j 2
    sudo make install
  9. Install NPM
     curl | sudo sh
  10. Set up shared folders
     // Add node.js folder to Shared folders (VirtualBox menu)
    mkdir /home/mike/node.js
    sudo mount -t vboxsf node.js /home/mike/node.js // add to /etc/rc.local 

No comments:

Post a Comment