Step 1 – Prepare Your System
In this tutorial we’re going to virtualize Ubuntu 8.10 on OS X 10.5.6 using Sun xVM VirtualBox 2.1.0. To prepare for this tutorial you should download the necessary resources:
This tutorial was tested on an Apple Macbook Pro with an Intel Core 2 Duo CPU with 2GB RAM running Mac OS X 10.5.6.
[#PAGE-BREAK#Step 2 – Install VirtualBox#]
While either of these options is more than acceptable we chose VirtualBox because we wanted to base the tutorial on a platform which was free whereas the others are excellent but proprietary.
During testing we were very impressed with VirtualBox and are using it as the platform for all our virtualization tutorials.
To install VirtualBox download the VirtualBox DMG package. Open the downloaded file to mount the disk image (or it may automatically open from some browsers) and then double-click the VirtualBox.mpkg to launch the installer.
On the License Agreement page click Continue and then Agree
Select the hard drive you want to install to and click Continue and then Install. Once installed launch VirtualBox from your Applications folder.
[#PAGE-BREAK#Step 3 – Create New Ubuntu VM#]
Click the New icon to start the New Virtual Machine Wizard
- Click Next
- Type in “Ubuntu” as the name and select “Ubuntu” from the “OS Type” dropdown menu. Click Next
- Assign as much memory as you like beyond the base memory recommendation. In this case 256MB is the recommended amount. Click Next
- On the “Virtual Hard Disk” screen click “New” to launch the Create New Virtual Disk Wizard and click Next.
- Choose whichever disk type you prefer. The advantage of a fixed-size image is that as all the space is reserved up front there’s an ongoing disk performance benefit as the image doesn’t need to keep expanding as you use it. The downside is that all the space is used at once and it takes longer to create. Click Next
- Name the image file accordingly and assign some space (at least 8GB for the Ubuntu boot disk). Click Next and then Finish. The newly-created Ubuntu.vdi is now attached to the VM as the primary disk. Click Next and then Finish and the VM is created
[#PAGE-BREAK#Step 4 – Install Ubuntu#]
Download the latest version of Ubuntu – at the time of writing the version was 8.10 (Intrepid Ibex). You just need the normal 32-bit desktop ISO (ubuntu-8.10-desktop-i386.iso).
An ISO is a cross-platform image file of a CD or DVD which contains all the imformation relating to the original media – it can be bootable or a DVD Video whatever really. It’s not an application package like a DMG – in this instance the Ubuntu ISO is an image of the installation media so you could use the ISO to create a bootable CD if you wished.
Installing from the ISO is quicker than from CD but it does result in more intense hard drive activity.
To install from the ISO highlight the Ubuntu VM and in the right-hand side of the screen click “CD/DVD-ROM” then tick “Mount CD/DVD Drive” and then “ISO Image”. There are no images available for selection in the dropdown menu so click the folder icon. This opens the Virtual Disk Manager – VirtualBox cleverly keeps track of all the ISOs you access regardless of where they’re kept and catalogues them making it much easier to access them later.
Click Add and browse for the Ubuntu ISO then click Select and then OK. The ISO is now attached to the VM as the primary optical drive.
Highlight the Ubuntu VM and select Start. This starts the VM connects you to the machine and as there is no OS present on the virtual disk boots from the mounted ISO.
To interact with a VM you have to click into the window which contains the running instance. Doing this will “capture” the keyboard and mouse. You won’t be able to interact with the Mac desktop but you will be able to interact with the VM. To escape back to the Mac desktop click the Host key. For VirtualBox on OS X the Host key is mapped to the Left Command button.
This is the default behaviour on all VirtualBox VMs but you can enable seamless integration by installing guest addition tools which we’ll do once Ubuntu has been installed.
Select your installation language using the keyboard (the default is English). If you want to boot into the Live CD environment choose the top option “Try Ubuntu without any change to your computer”. You can start the installation from within the Live CD GNOME interface. To install Ubuntu straight away select “Install Ubuntu”. You don’t need to select any of the various boot options available.
- on the Welcome screen select the Language and click Forward
- on the “Where are you?” screen select your locale and click Forward
- select the appropriate Keyboard layout and click Forward
- on the “Prepare disk space” screen select “Guided – use entire disk” and click Forward
- on the “Who are you?” screen type in your username and password details and click Forward
[#PAGE-BREAK#Step 5 – Install Guest Additions#]
Most virtualization solutions offer a software package which can be installed on guest machines which provides better access to the host hardware and other resources like shared folders clipboard file copying and so on.
Once the Ubuntu VM has been installed and has rebooted you’ll be presented with a GNOME logon screen. GNOME is the desktop interface which Ubuntu uses – you can find out more about it here.
Then press the host key to release the cursor then select the Devices menu and then “Install Guest Additions”. This mounts the additions image into the VM.
Click back into the Ubuntu VM. The mounted guest additions ISO is set to autorun but the autorun package will fail. This seems to be a bug in Ubuntu – it’s not indicative of any particular problem but it does mean that you’ll have to install the guest additions from the command line.
Click back into Ubuntu and open a terminal – Applications Accessories Terminal. Type in the following command:
“sudo /media/cdrom/VBoxLinuxAdditions-x86.run” and press Enter (assuming you’ve installed a 32-bit Ubuntu system). This will start the Guest Additions installation script. Type in your password when prompted.
Once complete reboot the system for the additions to take effect. The shortcut to reboot from the terminal is:
“sudo shutdown -r 0“
[#PAGE-BREAK#Step 6 – More VirtualBox Options#]
By default and presumably to maximise compatibility during installation there are a number of guest options which are disabled but which you’ll probably find it useful to enable once the system is operational. To access these options highlight the VM in VirtualBox and then click on “General” in the right-hand window.
Under General there are two particular tabs of interest – Basic and Advanced. Under Basic you can adjust both the system and graphics memory. The graphics memory is expandable up to the available system graphics memorya nd you can also toggle on or off support for 3D acceleration for the guest VM.
Under Advanced you can add or remove options from the boot order and adjust the order itself. You can also enable support for CPU virtualization which will improve system performance.
You can also enable Audio support add more network adaptors connect to the host system’s serial and USB ports share folder between the host filesystem and the guest and enable remote desktop access to the guest via VirtualBox’s RDP server.
If you’re familiar with other virtualization packages then VirtualBox will be very intuitive. If not spent some time playing with the other options such as system snapshots to save a virtual guest at a point in time (very useful for writing tutorials!) moving into and out of fullscreen by using the host+F key combo.
Also check out our other tutorials for virtualizing on different platforms.