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.
If you enjoyed this article, you might also like..
|
|
|
|











My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 14 comments… read them below or add one }
Not a bad tutorial. Can I suggest a second, follow-up topic? The two biggest issues I have with Virtual Box are 1) getting a virtual machine to run automatic and headless at host startup, and 2) installing guest tools on linux VMs. Both of these topics can be tricky based on guest VM OS.
thanks for the tutorial. I have been using Virtual Box for years to take new distrobutions that I am interested in for a spin.
Jeff…..Oracle has the ability to run automaticly and headless…..howtoforge.com has a great article on this that will walk you through doing just this sort of thing. If you want the virutal machine to continue running after you kill your ssh session use a nohup when you run the VBoxHeadless command. Hope this helps
I would like to see examples of running VirtualBox on Windows7 and running Linux as guest OS. Thx.
Yeah, once in university i try to install the Guest Additions in a CentOS 5.3 and it was’n tanything like smooth ride. It was very hard and like Jeff i think that is a pretty cool idea for you to do a second part of this tutorial.
I’m from Mexico and really, really dude your posts are the best. I love your blog
A good tutorial, I thought it was clean and easy to understand. I have thought about delving into using a virtual box for a while but just never took the time to look into it. I’m glad you put this out.
Great…Thank you…
@jeff,
1) To start the VM automatically at host start-up, in /etc/rc.local enter the below command.
VBoxHeadless –startvm “Machine-Name”.
It works for both windows and debian as guest OS.
2) With regard to installing the Guest Additions, I’ve not had issues with windows Guest OS and Debian/Ubuntu Guest OS. I can help, if you provide me the exact problem you faced.
I’ve had a less than stellar experience with VirtualBox. The host was Windows Vista 64-bit and the client machine Solaris 11 64-bit. Four installation attempts and at no point was the OS ever accessible. If it didn’t lock during the initial installation, it would would boot and hold at a splash screen indefinitely.
Installed VMware Workstation 8 and Solaris 11 installed the first time and works wonderfully.
Hard stuff…
@addison I seem to recall a blurb that currently you can only install 32-bit versions of Linux OS in a WIndows 7 VirtualBox. This may also be true for Vista.
@Will I found installing VirtualBox on Windows 7 to be straightforward. Download the exe file (currently 4.1.8) and run it. I agree a tutorial would be nice.
I would also like to see a tutorial on “Exporting and Importing”. I have a few log-ons on my Win. 7 and it looks like I installed VirtualBox twice (for 2 Win. 7 users). One uses a separate partition for the virtual machines (which is what I want) and the other installed the virtual machines in its partition (rather than in the separate partition). Trying to read through the humongous PDF is trying to say the least.
Another discussion would be nice is reading the VDI file under Windows (or setting up a “shared directory” for data exchange).
Hi,
Very nice article..
nice tutorial, but for me little bit useless – I am hobbyist using virtualbox over 3 years.
What about try tutorial for VMware?
@Alex
VMWare tutorials are already available. Please check out the archives page
http://www.thegeekstuff.com/archives-2/
I have been running 64-bit RHEL6.1 under VirtualBox 4.1.* on a Windows 7 64-bit Dell M4500. Just installed 4.1.14, and am now running an MRG 2.0 kernel which had not worked previously.
Always, ALWAYS getting better…
You certainly can’t run a 64-bit OS as a guest on a 32-bit host, but 64-bit Linux on 64-bit Windows 7… yes we CAN! (Sorry, lost it for a moment…)