Lean Mean Ubuntu Virtual Machine

I use Mac OS X for my daily tasks, but some software just isn’t available or doesn’t run as smoothly on a Mac. To design circuit boards I use KiCAD and for developing my latest product I need to compile Linux images. For both, having a Linux installation on your computer which you can fire up in seconds is invaluable. In this post I will show you how to make a small but up-to-date Linux virtual machine using the Ubuntu Server install disk and VMware Fusion.

Virtual Machines

Ubuntu in a window

Many Mac users may be familiar with Parallels or VMware Fusion. Both allow you to run Windows on your Mac in a so-called virtual machine. Having a virtual machine is like having an extra computer in your computer. The virtualization software pretends to have a hard disk, processor, memory and other items you would find in a computer or laptop. Inside the virtual machine you can install an operating system like Linux, Windows or even another copy of Mac OS.

Requirements

  • You need a copy of VMware Fusion, but if you don’t own a license it might be better to use the open source (and free) VirtualBox. The instructions here are for VMware Fusion
  • The Ubuntu server iso. As of writing the latest version is 11.10. You can download it from the Ubuntu website. I recommend the 32-bit version for its smaller file size.

In VMware Fusion create a new virtual machine. Choose ‘Continue without disc’, then ‘choose disc image’ and browse to your ubuntu server iso. Follow the instructions on screen, finally press ‘Finish’. You are now greeted by the Ubuntu install menu. Before pressing install, press F4 and choose ‘minimal virtual machine’. This option makes the Ubuntu installer install as few packages as possible, making a very small operating system.

Press install and follow the instructions. After the installation and reboot you will see a black screen with a trusty old blinking cursor. Dont’ panic, we’ll get you a graphical user interface as quickly as possible!

First log in using the username and password you provided at the start of the installation. Then install lightdm by typing the following into the command line:

sudo apt-get install lightdm
sudo apt-get install gnome-core

During the installation of gnome-core choose lightdm as the display manager. Next, install xorg and unity-2d:

sudo apt-get install xorg
sudo apt-get install unity-2d

Reboot! If everything went right you are greeted with a lean and minimal desktop that boots up very quickly and uses about 2GB of disk space.

To enable cursor sharing between OS X and Ubuntu and some other tweaks, go to to Other -> Synaptic package manager and search for open-vm-tools. Mark it for install. You might also want to search for light-themes if you want the default Ubuntu theme. I like it because it has the minimize/close buttons on the left just like Mac OS X.

If after rebooting Ubuntu fails booting with an error like Alert: cannot find /dev/disk/uuid-xxxxx, justjoheinz has a solution on his blog.

5 Responses to “Lean Mean Ubuntu Virtual Machine”

  1. Jean-Claude Wippler

    Thanks – works great under Parallels as well, and the fix mentioned at the end is needed, i.e. use SCSI iso SATA.

  2. follower

    Thanks for this guide I followed it a few months ago to get KiCAD running on OS X.

    However, in the past couple of days I ran into a related problem that turned out to have a really simple solution but it took me ages to find the correct solution.

    The kernel package installed by the “minimal virtual machine” option only contains a small number of modules. It’s possible you may need one of the “missing” modules to get extra hardware supported. (In my case I wanted to access my MacBook Pro’s internal USB Bluetooth device from Ubuntu.)

    You *don’t* have to build the modules yourself, you can simply install the associated “linux-image-extra-virtual” package and all the missing modules will be installed (at the cost of some extra disk space). (The description of the package currently implies a kernel image is installed also but that’s not the case.)

    I hope this helps someone avoid the hours of frustration wondering why a minimal VM install didn’t support hardware that an older full VM did!

  3. Sandy

    I noticed that this post is an year plus old. Would you suggest anything different at this point?

  4. David

    @Sandy: I’m still using exactly the same setup with Ubuntu 12.04 LTS instead of 11.10. The newer Ubuntu’s don’t add anything worth upgrading for if you only use the OS once in a while.

  5. John Utz

    Hi! Nice post. If after rebooting Ubuntu fails booting with an error like Alert: cannot find /dev/disk/uuid-xxxxx

    But justjoheinz’s site on posterous is gone. can you tell me the gist of what he wrote there so i can get my minimal virtual machine running?

    tnx!

Leave a Reply