Oracle VM VirtualBox is an open source virtualization software that you can install on various x86 systems. You can install Oracle VM Virtualbox on top of Windows, Linux, Mac, or Solaris. Once you install the virtualbox, you can create virtual machines that can be used to run guest operating systems like Windows, Linux, Solaris, etc.
On a high-level Oracle VM VirtualBox is similar to VMware. Oracle got this VirtualBox technology from Sun.
This article cover the basic installation of virtualbox and how to install a guest OS on it.
If you are interested in VMware, use this guide: How to Create VMware Virtual Machine and Install Guest OS using vSphere Client.
The following are the basic terms you should be aware of before we go further:
- Host – The physical machine where you are going to install VirtualBox
- Guest – The machines created using VirtualBox. ( Virtual Machine )
- Guest Additions – A set of software components, which comes with VirtualBox to improve the Guest performance and also to provide some additional features.
1. Installing VirtualBox
This article explains how to install VirtualBox on a Debian based system.
First, add any one of the following mirrors based on your distribution in /etc/apt/sources.lst
deb http://download.virtualbox.org/virtualbox/debian oneiric contrib deb http://download.virtualbox.org/virtualbox/debian natty contrib deb http://download.virtualbox.org/virtualbox/debian maverick contrib non-free deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free deb http://download.virtualbox.org/virtualbox/debian karmic contrib non-free deb http://download.virtualbox.org/virtualbox/debian hardy contrib non-free deb http://download.virtualbox.org/virtualbox/debian squeeze contrib non-free deb http://download.virtualbox.org/virtualbox/debian lenny contrib non-free
Next, download the public key and register with apt-key for signature verification
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
Finally, installing VirtualBox as shown below.
sudo apt-get update sudo apt-get install dkms sudo apt-get install virtualbox-4.1
After successful installation a command named “virtualbox” will be created. Also you can access VirtualBox from “Application -> System Tools” menu.
2. Creating a Virtual Machine ( For Guest OS)
Open Application -> System Tools -> VirtualBox ( Command name is “virtualbox” )
Click Machine -> New. This will launch a “Create New Virtual Machine” wizard. Click Next.
Enter the name of the Guest machine as you desire and choose the Operating system and Version that you are planning to install as follows, and click “Next”.
Enter the RAM size that you want to provide to your Guest machine as follows.
Now it will ask you to choose your “Virtual Hard Disk” for installing the guest OS as follows.
Since this is the first time we are installing, click “Create New Hard disk”.
Create “New Virtual Disk” wizard will open. Click Next
Now we need to choose, whether the disk has to be “Dynamically expanding disk” or “Fixed-size storage”.
Remember, for a guest machine, it sees a file residing in the host machine as the “Hard Disk”. Whenever a guest machine does any write to disk, it will be written into the file which resides on the host machine
If we select “Fixed storage” and if we choose the size as 10GB then, in host machine ( by default under .VirtualBox/Guest-Machine/Guest-Machine.vdi ) a file will be created with 10GB of size
If we select “Dynamic storage” then, .VirtualBox/Guest-Machine/Guest-Machine.vdi will initially be a small size file, but it will grow whenever the guest machine writes data to the disk.
Choose “Dynamic storage” and click Next.
Enter the maximum size that you want to allocate for the guest machine.
Click Finish. Now a file named “Guest-Machine.vdi” will be created under “.VirtualBox/Guest-Machine/”
Click “Finish” to complete the creation of Virtual Machine.
Now a new “Virtual Machine” is created and it will be in “power off” state.
3. Installing OS in a Virtual machine
We can install any OS ( personally tested windows and linux ) on a virtual machine. We can install the OS in virtual machine by 2 methods
- Through OS-DVD
- Through ISO image of the OS
Here we will cover the installation using an ISO image, although using DVD is very similar to this.
Make sure that the iso file of your distribution is present in the host machine.
Launch “virtualbox”. Select the newly created virtual machine. Click “Settings”.
Now a new window will open which will list out the settings group on left panel and actual setting on the right side as follows.
Select “System”. On the right panel ensure that the boot order is correct ( Similar to setting the boot order in BIOS ).
Use the “Move Up” or “Move Down” button button to change the boot order, and make sure CD/DVD is selected as the “First boot device” and click “Ok”.
The next step is to map the “ISO file” of your distribution to the virtual CD/DVD device.
Under “Settings” go to “Storage”, the following screen will appear.
Click the “CD icon” and choose the “iso file of the OS”, here I used “Debian-Lenny”.
The following screen will appear once you have choosen the ISO file. Click “Ok”.
Now select the virtual machine, and click “Start”. It will start to boot from the CD/DVD which is mapped to the ISO file.
The OS installation is similar to installing an OS in a physical machine.
Once OS is installed successfully, change the “Boot Order” to boot from HDD, and click “Start”.
Now you can start using the virtual machine as like other machines.