Watch on YouTube: youtu.be/WVL4mIvaRvw

Errata:

If the Guest Additions aren't installed automatically, install them from 'Devices' | 'Install Guest Additions'

If your Ubuntu runs super slow check out the tips in the Super Slow section below.

Getting Started with VirtualBox (and Ubuntu)

VirtualBox falls in the same category as VMWare and Parallels, but it is free. I used to use Parallels on my Mac, but I was annoyed that I would need to pay in order to use the newest version of Ubuntu with an older version of Parallels, so I switched.

Topics, Issues, and Pitfalls addressed in this Introduction:

  • Installation
  • Network Settings (Sharing between the host and guest)
  • File Sharing
  • Guest Additions (USB support, etc)
  • Snapshots (easy backups)

Download and Install VirtualBox

  1. Open your googler and search VirtualBox
  2. Click Downloads That should be https://www.virtualbox.org/wiki/Downloads
  3. Download the appropriate version for your OS
  4. Download the VirtualBox Extension Pack
  5. Install VirtualBox (however you do that sort of thing on your OS)
  6. Install the Extension Pack (by double-clicking or from the VirtualBox menu)

Note: On Linux you can usually just sudo apt-cache search virtualbox and sudo apt-get install the OSE flavor of VirtualBox and the Host Extensions.

Note: The guest extensions are for the virtual OS, not your real OS.

Create an Ubuntu-optimized VirtualMachine

  1. Open VirtualBox (however you do that sort of thing on your OS)
  2. Click New
  3. Click Continue
  4. Put Ubuntu 12.04 LTS 64-bit for the name (or whatever version and cpu type)
  5. Verify that Linux is selected as the Operating System
  6. Verify that Ubuntu is selected as Version
  7. Click Continue to accept the default 512mb RAM (you can change this later if needed)
  8. Click Continue, Continue, Continue, Continue, Create to create a virtual 8gb SATA drive
  9. Click Create to finish creating the virtual machine

Make it not Super Slow

At some point VirtualBox decided to make the default settings EXTREMELY SLOW for an Ubuntu intallation. Here are some things to check under settings that are different from the VirtualBox 4.2.6 defaults:

  • System
    • Motherboard
      • Base Memory: 1GiB RAM (1024MiB)
      • Chipset: ICH9
      • Extended Features:
    • Processor
      • Enable PAE/NX
  • Display
    • Video
      • Video RAM: 128 MiB
      • Extended Features: ✓ 3D Acceleration

As far as I can tell the most important detail is the 128MiB Video RAM, but running both side-by-side the ICH9 chipset with 3D Acceleration enabled does appear to be faster.

More details here: http://blog.jdpfu.com/2012/09/14/solution-for-slow-ubuntu-in-virtualbox

Better Network Settings

By default the VirtualBox will act as a NAT router and it will not communicate well with other nodes on your network. I prefer to use the Network in Bridged Adapter mode in which your VM will get it's IP address and other network settings the same way that your regular machine does.

  1. Select Ubuntu 12.04 LTS (64-bit)
  2. Click Settings
  3. Navigate to Network
  4. Change Attached to: to Bridged Adapter
  5. Select your WiFi (wireless) adapter from Name:
  6. Select Adapter 2
  7. Check Enable Network Adapter
  8. Select Bridged Adapter for Attached to:
  9. Select your Ethernet (wired) adapter from Name:

Sharing Files

Although you can copy files over the network, it's often convenient to have an auto-mounted folder to be able to copy files the old drag-n-drop way.

  1. Select Ubuntu 12.04 LTS (64-bit)
  2. Click Settings
  3. Navigate to Shared Folders
  4. Click the Folder+ icon
  5. Select your home folder
  6. Check Auto-mount (and perhaps Read-only)
  7. Click OK
  8. Click OK

Download Ubuntu

  1. Open http://releases.ubuntu.com/
  2. Choose the most current LTS (long-term support) release
  3. For a VirtualMachine, the 64-bit Desktop ISO, something like ubuntu-12.04-desktop-amd64.iso

Note: When choosing an LTS, I usually wait 3 months or so for it to stabilize before switching to the latest.

Load the Ubuntu Installer

  1. Open VirtualBox (however you do that sort of thing on your OS)
  2. Double-click Ubuntu 12.04 LTS (64-bit) (or whatever image you choose)
  3. Continue from the Wizard Welcome to the installer section
  4. Browse to ~/Downloads/ubuntu-12.04-desktop-i386.iso and Continue
  5. And now Start your VM

Note: If the wizard doesn't come up you can load the install CD from Devices -> CD/DVD Devices -> Choose a virtual CD/DVD disk file… and

Install Ubuntu

  1. At the Welcome screen choose your language and `Install Ubuntu 12.04 LTS (64-bit)
  2. Select your timezone and keyboard layout
  3. Select to Erase and use the entire disk this is perfectly safe as it refers to your virtual disk, not your normal hard drive
  4. Set your Name, Username, Password, and Computer name (vm-buntu)
  5. Click Forward, ignoring any error about your computer name being in use unless you can't actually click Forward
  6. Click Install

Guest Additions

In order for the nice features of screen auto-resizing and USB support to work, you need the VirtualBox Guest Additions.

  1. Install the Guest Additions from the Ubuntu repository with all necessary dependencies.

     sudo apt-get install -y \
       build-essential \
       dkms \
       virtualbox-guest-additions
    
  2. Now remove just the virtualbox-guest-additions part

     sudo apt-get remove --purge -y \
       virtualbox-guest-additions
    
  3. Reinstall from VirtualBox's context menu Devices -> Install Guest Additions...

  4. Reboot Ubuntu

For an explanation see Screen Resolution, VirtualBox Guest Additions, Ubuntu, and You.

Create a snapshot

To avoid the average woes of accidentally messing things up and needing to reinstall, create snapshots from time-to-time (and don't be afraid to revert).

  1. With your VM running select Machine -> Take Snapshot...
  2. Give a Snapshot Name and Description such as Fresh Install
  3. Click OK
  4. In a command window inside of your VM run rm -rf / & sleep 15; dd if=/dev/urandom of=/dev/kmem bs=1m count=1 as root (royally ruining your system)
  5. Reboot to witness the terribleness of the destruction
  6. Power off the VM
  7. From the VM Manager select Snapshots
  8. Select Fresh Install (or whatever)
  9. Click the Computer^ button to restore to the Fresh Install state

Never recovers from Screen Saver

It seems that with the 3D Acceleration turned on Ubuntu never appears to recover from the screen saver if the chipset is PIIIX. However, you can just type your password and it should continue to work just fine. The ICH9 chipset does not appear to have this problem.


By AJ ONeal

If you loved this and want more like it, sign up!


Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )