ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Guide to Installing and Setting Up Ubuntu (Linux) on a VirtualBox Virtual Machine for Windows or Mac

Updated on September 25, 2014

What is a Virtual Machine?

A virtual machine (VM) is simply an emulated computer system with software. Think a computer within a computer. This emulated system (guest OS) is isolated in its own space on a hard drive and separated from the host system (host OS) running it. Virtual machines are great for running several operating systems (OSs) in tandem and can be used to get the benefits of of many OSs on a single physical machine.

Some of the main benefits of using a VM are:

  • Access software from many OSs at once
  • Test out new software
  • Protect the host OS from malware, viruses, and other bad software
  • Learn about OSs and software without worrying about "messing up" a computer and making it unusable. Freedom to play around!
  • Create completely separate operating environments for many users on the same computer

This guide will discuss VirtualBox (VB)-- a free, fast and powerful piece of virtualization software for creating virtual machines.

Why run Ubuntu in a VirtualBox?

  • Ubuntu (a Linux distribution) is a very powerful and flexible operating system (OS), great for everything from browsing the web, to file management, to programming complex new software. And it's free!
  • Tons of great, free software for Linux is available to you. Chances are if you want to do something on a computer, it can be done in Linux, oftentimes even more efficiently than you are used to and for free.
  • Oracle's VirtualBox (VB) software allows you to keep Ubuntu (or any other OS) completely separate from your normal system.
  • You can run Ubuntu in its own window through your normal OS. No more selecting what OS to boot in to at start up. Why choose when you can just use them both at the same time!
  • VirtualBox can hold many operating systems and you can boot in to any of them at any time. You can even run many at once!
  • Learn valuable new computer software skills to build your resume and stand out from a pool of applicants.

Virtual Machines Quiz!

view quiz statistics

Step 1: Installing VirtualBox

Let's get started. Installation instructions will be similar for Windows or Mac. This guide uses Windows 7. Running virtual machines on your host OS will take up a significant amount of computer resources. If you have an older computer that is having trouble running your host OS, as-is, then you may want to consider upgrading before running a guest OS as well. For instance, Ubuntu, Windows 7 and other guest OSs will run great in virtual machines on a 2014 Macbook Air.

1. Download the latest version of VirtualBox from for Windows or Mac.

2. During installation, keep all install options selected and choose a location to install. Be sure to check the box to "Register file associations." When a warning about network interfaces pops up, select yes to proceed with the installation. You will temporarily be disconnected from the network.

If you choose to install to an external USB drive, your virtual machines will not be portable to other computers without VirtualBox. For portability, you will need to use Portable-VirtualBox. Keep an eye out for a future hubpage by me on this very topic!

Options When Installing VirtualBox
Options When Installing VirtualBox | Source

3. Download the latest VirtualBox (VB) Extension Pack from and save it to your hard drive. Open it and let VB install it.

You can manually install the Extension Pack from the VB Settings Menu under 'Extensions'. See the VB installation manual for more details on what is contained in this pack. The screenshot below is for a manual installation only and should only be done if the extension pack did not install automatically when opening it.

Manually Installing VB Extension Pack
Manually Installing VB Extension Pack | Source

4. Select a location to store your virtual machines in the General settings of VB

Virtual machine storage selection
Virtual machine storage selection | Source

Installing Ubuntu

1. Download the latest version of Ubuntu Desktop from The download section will help you with what version to get. For this guide I will be using version 14.04.1 LTS 64-bit. Note: if you have installed VirtualBox to a separate hard drive, you may need to burn the Ubuntu disk image to a disk for use during installation.

If you can't or don't want to download the distribution (it is about 1 GB in size), or would like a set of installation disks (along with a bootable flash drive preinstalled with Ubuntu) follow the Amazon link below.

Tip: When choosing a version of Ubuntu to use, know that LTS stands for "long-term support" and will have 5 years of support and updates from release. Newer versions (standard releases) will have the latest features, but may not be as stable and do not have the same timeline for support. Standard releases are only supported for 9 months.

2. Run VirtualBox and click the "new" button. Select type: Linux and Version: Ubuntu

Tip: This guide uses Ubuntu 64-bit. If you have a 64-bit processor with hardware virtualization support (that is enabled), you will want to use the 64-bit Ubuntu distribution. If you are unable to select Ubuntu (64bit) from the Version menu, try restarting your computer before continuing. Also see the troubleshooting section towards the end of this guide for help to see if your processor supports 64-bit guest OSs and on enabling hardware virtualization technology on your computer.

If your processor does not support a 64-bit guest OS, then you will need to download and use the 32-bit Ubuntu distribution.

Creating a new virtual machine
Creating a new virtual machine | Source

3. For memory size, more is better, however the amount of memory you select, will not be available to your host OS. 512MB is recommended, however you may want to bump this up to 1024 if your system has 8+GB of RAM. You can always change this later.

Selecting Memory Use in VirtualBox
Selecting Memory Use in VirtualBox | Source

4. Create a virtual hard drive. This is where your virtual machine will be installed to. You can read about the different options in the VirtualBox documentation, but for this guide we will choose a VDI (virtual disk image) that is dynamically allocated. The size of your virtual drive is up to you. Ubuntu will take up about 8 GB when we are finished, but you will want room for all your applications and files. I will use 80 GB for this guide.

This virtual hard drive and other virtual machines you want to make will take up a significant amount of space and it's never a good idea to max out (or even come close to maxing out) the space used on your host OS or guest OS, or things will slow to a crawl!

Operating systems need plenty of room to operate. Expand your storage space with a second internal hard drive (This 3 TB Western Digital Caviar Green is almost 50% off right now!) or with an external hard drive that you can take with you and/or hook up to other computers. These drives are always going on sale can be used to store your virtual machines and all your other files.

Create a Virtual Hard Drive
Create a Virtual Hard Drive | Source
Select Drive Type
Select Drive Type | Source
Storage Options
Storage Options | Source
Virtual Hard Drive Space
Virtual Hard Drive Space | Source

5. Select your new virtual machine in the VirtualBox manager and press the start button (green arrow). It may take a little while for the Ubuntu installation prompt to show up. If you get stuck on this step and the virtual machine won't start, see the troubleshooting section at the bottom of this guide.

Starting the Virtual Machine
Starting the Virtual Machine | Source

6. Navigate to the Ubuntu image you downloaded in step 1. You can also select your optical disk drive and install from a burned image.

Installing Ubuntu
Installing Ubuntu | Source

7. Ubuntu will now guide you through the installation process. During installation you should select "Install Ubuntu" and tick off "Download updates while installing" as well as "Install this third-party software" that will give you some basic and useful software additions.

Install Ubuntu
Install Ubuntu | Source
Ubuntu Install Options
Ubuntu Install Options | Source

8. During installation, you can select to enable disk encryption for increased security if you like.

Ubuntu Install Options
Ubuntu Install Options | Source

9. Select a user name, computer name and a password. Continue on with installation.

Ubuntu Install Options
Ubuntu Install Options | Source

Configuring Ubuntu to Work with Virtual Box

Before we get started using Ubuntu, there are a few things we will need to do to get it working correctly with VirtualBox (VB).

1. First things first, you are going to want to load the Guest Additions CD image. This will help Ubuntu work with VB. To do this, from the VB menu select 'Devices' and then 'Insert Guest Additions CD Image...'.

2. A box will pop-up asking you if you would like to install software. Click cancel.

Load VirtualBox Guest Additions CD
Load VirtualBox Guest Additions CD | Source
Cancel Automatic Installation
Cancel Automatic Installation | Source

3. Verify that your internet is working withing Ubuntu by launching Firefox from the menu on the left. If it is not working, see the networking section of the VB manual:

4. Open up a terminal in Ubuntu by clicking the "Search your computer..." menu button at the top left. Type in 'terminal' in the search box. Select the Terminal application and launch it.

5. First let's install some prerequisites for the VB Guest Additions. In your terminal type the following commands (no quotes):

sudo apt-get install dkms

sudo apt-get update && sudo apt-get upgrade

(this will update the list of available packages from the Ubuntu repositories and update your installed programs)

Using the Linux Terminal
Using the Linux Terminal | Source
sudo apt-get install linux-headers-generic

(this will update the kernal headers)

6. Navigate to the guest additions CD directory and install the guest additions (command will vary based on your computer name (mine is pumpkin) and your VBoxAdditions version (mine is 4.3.16_95972 in this example).

cd /media/pumpkin/VBOXADDITIONS_4.3.16_95972

(If you are having trouble, you can use the "ls" command do see what folders are in the current directory)

sudo ./

(install the guest additions)

Intermediate Step of Installation
Intermediate Step of Installation | Source
sudo bash -c 'echo vboxvideo >> /etc/modules'

(add the driver to the VM)

7. After installation, go ahead and power off your virtual machine

8. Now it's time to do some more configuration on our virtual machine. Select your Ubunu virtual machine in the VirtualBox Manger and select "Settings". Under the System settings, you can unselect Floppy and CD/DVD from the boot Order and move Hard Disk to the top.

VirtualBox Boot Order Selection
VirtualBox Boot Order Selection | Source

9. Under Display settings, tick off the "Enable 3D Acceleration" box

VirtualBox Enable 3D Acceleration
VirtualBox Enable 3D Acceleration | Source

10. Next under Network, you can specify what type of networking you want to use. For this guide I will use Bridged Adapter. See the networking section in the VB manual for more information:

VirtualBox  Select Network Type
VirtualBox Select Network Type | Source

11. Finally, under USB settings, make sure USB is enabled and tick off the "Enable USB 2.0 Controller" box.

12. Boot Ubuntu back up!

Configuring Ubuntu and Getting Started

Now Ubuntu is looking a lot better, no more tiny display window! There are just a few more things we need to do to to get started. First off, you should launch Firefox to verify that your internet connection is working inside Ubuntu. If it is not, you may need to switch from Bridge Networking (in above section, step 10) back to NAT networking or another option that will work for your network. Let's keep going!

1. Test out your new video settings with this command (all reports should show green 'yes'):

/usr/lib/nux/unity_support_test -p
Test out Unity
Test out Unity | Source

2. (optional) Install the CompizConfig Settings Manager with this command:

sudo apt-get install compizconfig-settings-manager compiz-plugins

If you are having trouble with your windows flickering, disappearing or other such problems, you will need to turn frame buffering off. To do this run the newly installed CompizConfig Settings Manager with the terminal command:


Once open, navigate to the OpenGL section and untick the FrameBuffer option.

Turn Off Framebuffer object (optional) in Ubuntu ccsm
Turn Off Framebuffer object (optional) in Ubuntu ccsm | Source

3. Install java and flash

sudo apt-get install openjdk-7-jdk flashplugin-installer

4. Install Ubuntu restricted extras (This includes things like mp3, avi, mpeg, TrueType and codecs). Some of these will already be installed, from the initial setup and from step 3, but I've found that some aren't and it's good to run anyway.

sudo apt-get install ubuntu-restricted-extras

Tip: during the TrueType installation, you may not be able to click the "Accept" or "OK" buttons. Use the tab key to navigate.

5. Install VLC media player

sudo apt-get install vlc

6. From here, there is a ton of great software available for you. You can either use the Ubuntu Software center (shortcut is on the menu to the left) to browse and install software, or just use the repositories like we have been doing during installation.


Hardware Virtualization Technology

If you are getting errors about VT-x or AMD-V or needing to enable hardware virtualization, your computer processor may not have hardware virtualization technology or it may be disabled on your system.

This may also cause you not be be able to select Ubuntu (64bit) as an option for your virtual machine when creating a VM.

Please see my (future) hub on hardware virtualization technology to see if your processor supports it and if so, how to turn it on!

Until published, please check out the VirtualBox Forums (linked in the Additional Resources section of this hub) or try Google.

Virtual Machine Will Not Start

Sometimes, VirtualBox in Windows has trouble starting a virtual machine due to a bug and it will infinitely try to start the machine, never getting past 0 percent progress. If you run in to this error, you will need to start killing VirtualBox processes in your Windows Task Manager and then restart VirtualBox, or just restart your computer.

Other Linux Distributions

This guide isn't limited to Ubuntu. There are many other great Linux distributions available out there to suit your specific needs and most are free. The majority of this guide can be applied to other distributions with a little extra research. You can make virtual machines for different distributions and try as many out as you like until you find your favorite.

Here is a list of the 300 most popular distributions (yes there are that many and more!):

Linux Distribution Preference

What is your favorite distribution of Linux

See results

Additional Resources

Here are some additional resources and places you can go to get help with VirtialBox, Ubuntu and installation. - The VirtualBox User Manual -The VirtualBox Forums - Ubuntu Documentation - The Ubuntu Forums

Ubuntu Unleased 2014 - Comprehensive book to help you make the most of Ubuntu - Using the Linux Terminal


    0 of 8192 characters used
    Post Comment

    • profile image

      Simon 5 months ago

      what does the last line in step 6 mean?:

      - sudo bash -c ' echo [...]'

      when I execute it nothing happens.


    Click to Rate This Article