Articles

Virtualization is so easy it’s unreal [Guest: Ubuntu 8.04, Host: Leopard]

In howto on May 31, 2008 by theoryl Tagged: , , , ,

I finally decided to use VirtualBox, a free virtualization solution developed by Innotek and later bought by Sun, to install Ubuntu on top of my Macbook. Initially I would like to perform dual boot. But, one thought prevented me: “Why would you buy the expensive Macbook to install Ubuntu?” Indeed, why would you want to use Ubuntu only on Macbook is the question.

However, I’m not completely satisfied with Mac OS X Leopard — there are shortcomings despite all the wonderful picture Apple has tried to paint. I should talk about them in more details in a new post, however, here are a few:

  1. No way to mount a remote server via SSH;
  2. Its terminal is not a real terminal, but it’s just an application that is subject to bugs/crashes;
  3. I would like to install softwares from repositories, instead of each application having its version checking;
  4. Safari is very inflexible! Firefox 2 is not stable and looks ugly on a Mac;
  5. Any Windows user will complain about the prices of useful softwares and the lack of open source softwares;
  6. This is more of a Microsoft problem, but the extremely unstable Office Mac (2004 & 2008) really freaked me out!


So I just downloaded the VirtualBox 1.6.0 installer from Sun. Install as you normally would. Hey, you notice? The program is only ~ 30MB, and it can do virtualization!? Unbelievable, I know, but it’s true that it does!

Then, launch VirtualBox.app. Click New. Give it a name, select Ubuntu as the OS type. Select Memory. It is recommended that the guest OS (Ubuntu in this case) has at least 256 MB. Since Mac OS X is quite memory hungry, while Ubuntu is not, I decided to allow Ubuntu only 256 MB of RAM. I think it’s reasonable, since my main working area will be Mac OS X, while Ubuntu only serves as an extra layer to do things Mac OS X can’t. On my other laptop, the HP DV 2015nr, the amount of RAM consumed by Ubuntu is usually 300 MB ~ 400 MB. But that’s also because I enabled visual effect (compiz fusion). So 256 MB should be fine (actually, when I started using it, I realized more than 256 MB is needed, even though 256 MB does work with some lag). More info in the manual.

Next, create a new virtual hard disk. From the wizard, select `dynamically expanding file’, in the next step enter 5 GB. This means that 5 GB of your hard disk will be prepared for this Guest OS. However, since a new OS doesn’t occupy that much space at the beginning, `dynamically expanding file’ setting only allocates hard disk space as needed, then grows as the needed space grows (as opposed to `fixed-size file’. Then you’re done!!

In your first run, you will be prompted to install the OS. I used the downloaded image file (.iso) which I used to install Ubuntu HH on my HP laptop. Everything should be quite self-explanatory for the installation. The last thing to do is, after the installation is completed, remember to select `Install Guest Additions’. This will install drivers into the guest Ubuntu OS. To do so, please consult here. The following is quoted from that website:

Here’s how to install it: open the Ubuntu virtual machine, click “Devices” at the top of the window, and then “Install Guest Additions”. Then go to “Accessories→Terminal”, type cd /media/cdrom0. Then type sudo sh ./VBoxLinuxAdditions.run and hit “Enter”. Follow the on screen instructions. Then, restart (hit the power icon in the top right corner). Now, the cursor isn’t trapped inside the virtual machine

[Advanced] To set up a shared folder, go to Devices –> Shared Folder –> Machine Folders, click the `Add Share’ button on the top right. Browse to a Folder Path, and give it a Folder Name. Then fire up the terminal in Ubuntu, enter:
sudo mkdir /mnt/share
sudo mount -t vboxsf [Folder Name] /mnt/share

A good thing about virtualization is that you can quickly suspend/freeze the Guest OS, like how you hibernate the real system, and recall it when you want to. If you have enough RAM, you will in fact see a much faster and better performance running a virtualized OS. A bad thing about VirtualBox (I don’t know about other vendors) is that you can’t copy/paste across the host and guest OSes. So, enjoy the best of two worlds!

p/s: you can also use the seamless mode as in Parallels. Just click Left-Cmd + L, and be amused!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: