As I’m sure some of my readers (all four of you) may know because of the IRC room, I’ve lately been trying to get nodejs running on a virtual machine (ubuntu since nodejs doesn’t like windows and I don’t want to virtualize osx) that is accessible from my host (windows) so I can use it for Lantern. Well I had a few minutes tonight to sit down and do some reading and I figured it out, hence the post so I don’t forget.
I’ll go right from step one in case anyone else is trying to do this with no prior knowledge 😉 I should also mention if you’re on *nix you don’t need to do this.
- Get virtualbox
- Get Ubuntu (or whatever distro tickles your fancy)
- Install a vm of ubuntu
- Download nodejs on vm
- Config/Make/Install – I had to install g++ and cmake to get it to build properly
- (The tricky part) On your host (windows) navigate to your virtualbox installation via command – something like this : C:\Program Files\Sun\VirtualBox\
- Run these commands :
VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol” TCP
VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort” 8000
VBoxManage.exe setextradata “ubuntu2” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort” 8000
- Launch your vm, start node js and on your host in a browser go to localhost:8000- HOORAY!
So here’s what I know about the commands what you need to edit to make it work
- Instead of “ubuntu2” use the name of your vm.
- the guestssh isn’t important. Just a name use to group the settings. Call it whatever you want.
- Guest and Host ports are the port you want to access on your vm.
- If you change you’re installation at all from the default you’ll have to figure out the other changers yourself here : http://www.virtualbox.org/manual/ch06.html#natforward
Good luck ^^