Develop Web Pages in Virtualbox

Develop Web Pages in Virtualbox

Sometimes for work purposes you have to use a Windows or a Mac, but you want your development environment exactly the same as you production environment. Which in my case is a Linux Machine. So I my development is in a virtualbox container, and I have my test browser and IDE in Windows. First you need to download virtualbox and install it on your host machine. Go ahead and download what your development machine will be(eg. ubuntu server), this will take some time.

Sometimes you have to do an extra step at the start, you have to make a host only adapter. Go to File->Preferences->Network->Host-only Networks. if you see a host only adapter already available, you are good. If not press the plus button on the right side.
host only adapter
This will add an adapter that is only available to your computer and not the rest of your network. This will make it easier to set up a network share between your two computers. The reason that I do not use the built in folder sharing built into virtual box is because I found that it is SLOW. Using a network share seems to be much faster.

Now create a new virtual machine by clicking the new button. Give the new machine a title, and choose Linux and Ubuntu 64. Click next and choose an adequate amount of RAM. At least 2GB would be good. Then create a virtual hard drive of VDI type. I usually chose a dynamically allocated hard drive type. Give it at least 5GB of space. However, if you choose dynamically allocated you can give it a large amount of space and it will only take up the space that it needs. Even if you tell it to make a huge hard drive. This will create the new virtual machine. Click settings for the new virtual machine->Network->Port Forwarding. Add a new rule to port forward port 80 and any other ports that you need to develop with. Then click the adapter 2 tab, enable it, and select a the host only adapter.

host-only-adapter-virtualbox

This adds a new adapter so that you can access the virtual machine just like a normal networked computer from your host machine. Go ahead and start the machine, mount your Operating System ISO to the machine. Then install the OS. Run ifconfig from the command line and you should see a couple of adapters. One should have an ip address similar to 192.168.135.100. This is the ip address that you will use to set up a network share. I will go into the steps in the next blog post.

No Comments

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked