
I am now consulting for myself and one of the things that I need to have is a test Linux box to play with. I am also lazy and do not want to maintain yet another computer (with it's associated costs) so I immediately turned to my good friend, virtualization. This also came around because my Leopard MySQL, PHP and Apache configuration is not working very well these days.
I had heard VirtualBox (1.6.2) had recently acquired Mac OS X support so I decided to give the platform a spin on my Intel-based iMac and report the results.
Easy as download, mount the disk image and run the installer.
I wanted to create a new Ubuntu installation so I grabbed the latest Ubuntu server ISO. While that was downloading I started to configure the new VM image. The wizard walked me through the steps fairly painlessly but I do have to admit to being a bit confused by some of the defaults selected. I had to boost the amount of RAM allocated to the image to 512MB. I had to ensure I enabled PAE/NX (for Ubuntu to even start) and I also had to use NAT (Network Address Translation) to for network connectivity as the other options do not work with OS X yet, or at least that is what the documentation says. Once I had my image configured I set the guest VM's CD/DVD drive to point to the ISO image I downloaded, set the drive boot order to CD/DVD first and Blamo! I was installing Ubuntu.
The use of NAT for the networking makes for some headaches if you want to actually talk to the Guest VM from the host VM, as I wanted to do - this is my LAMP test box after all, and it requires the use of port forwarding on the Guest VM.
The documentation is a little light on how this is done on OS X so for my future referral the commands I ran are as follows:
evan@foo /Applications/VirtualBox.app/Contents/MacOS
$VBoxManage setextradata "Linux Test Box" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol" TCP
VirtualBox Command Line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
evan@foo /Applications/VirtualBox.app/Contents/MacOS
$VBoxManage setextradata "Linux Test Box" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort" 80
VirtualBox Command Line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
evan@foo /Applications/VirtualBox.app/Contents/MacOS
$VBoxManage setextradata "Linux Test Box" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort" 8080
VirtualBox Command Line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
After I made these changes and restarted the guest VM I was able to setup a Drupal 6 install with no problems. It is visible at http://localhost:8080 and is running entirely on an Ubuntu server install. I get the bonus of running a true LAMP install that can be instantly restored to a previous running state as well as the great features of Ubuntu! All for free.