What is Virtualbox ?
Oracle VM Virtualbox or Virtualbox is the only open source software for virtualization.You can use this software to create virtual machines.Virtualbox is available for all major operating systems like Windows,MacOS and different Linux distributions.
Virtual Machine make it possible to run one operating system on top of other.Lets understand this with example.Suppose you have Windows operating system installed on your machine (referred as base or host operating system).You need Linux operating system for some work.Then you have option to install Linux in parallel with Windows (multi boot) or install Linux on top of Windows.
Installing Linux on top of Windows have many benefits.
- You can install any number of Linux distributions along side Windows.
- You do not have to reboot your system for accessing your host operating system or different installed system.
- You can easily share files and folders between all the operating systems installed.
- You can delete or reinstall the operating systems (except base one) without affecting others and with ease.
Having seen some of the benefits lets dive into more details about Virtualbox.
Virtualbox installation is pretty straight forward.The steps mentioned above do apply for all operating systems with slight modification of course
- Download Virtualbox from official site download link (according to your operating system).
- Download the extension pack as well.This is important as well.
- After downloading the file installation is like any other software.
- After installing Virtualbox just start the program.It is now time to install the extension pack we downloaded above.
- Double click the extension pack.A new window will open with Install option.Just follow the instructions to install the extension pack.
Creating Virtual Machine with Virtualbox
Oracle VM Virtualbox makes it extremely easy for newbies to create virtual machine.Follow below steps to create virtual machine
- Start the Virtualbox.
- Click on the New Virtual Machine Option or press CTRL and N keys together.
- Press the NEXT button on the screen displayed.This will bring below screen
- Choose the Operating System and Version on this screen.Give the name of virtual machine(you can give any name you want).In below case it is Fedora and then click on NEXT.
- Select the amount of memory to be used by new machine.The memory assigned to new machine should be less than 50% of total memory (RAM).You can slide the slider to increase RAM to be used by virtual machine.If you make it more than 50% then non optimal setting detected message gets displayed.
- Choose the boot hard disk for virtual machine.You can choose an existing hard disk or create a new hard disk.If this is first time you are using it then choose the option of creating new hard disk.This virtual machine will use this hard disk same way as your current installation uses your hard disk.
Which Virtualbox hard disk storage type to use?
While creating Hard Disks for the virtual machine users have two options for selecting hard disk storage type
- Dynamically Expanding Storage
- Fixed Size Storage
Below is the pros and cons of both the types
Dynamically Expanding Storage
Benefits — Dynamically expanding storage type is faster while creating the hard disk.It will be created within few seconds.This option helps in utilizing hard disk memory efficiently.Let the memory limit specified for the hard disk be 20 GB then only part of it is used and rest is available to the host operating system.The storage grows on need basis.
Drawbacks –While installing operating system the time taken is approximately double than normal installation time.The machine performs well after installation but slow performance is encountered while performing huge file operations or download operations.If you have only 1.5 GB storage free and you are downloading or copy files of size equal to or more than 1 GB then performance is very slow.The storage grows as needed causes this slowness. Sometimes the messages like no free hard disk space available pops up.This happens when memory falls below 250 MB. Until and unless there is need of expanding the hard disk space Virtualbox does not do it.
Fixed Size Storage –
Benefits — The installation time of operating system is normal.There is no performance issue like that of dynamically expanding memory method.The virtual machine works great all through.
Drawbacks — Fixed Size Storage is slower while creating the hard disk.It will be created in 40-45 minutes or even 1 hr depending upon size of hard disk to be created.The size of hard disk is fixed.So hard disk memory is not fully utilized.For example if user wants to create 20 GB hard disk then whole 20 GB is given to virtual machine whether the memory is used by virtual machine or not.
- Select the hard disk storage type depending upon your requirement.For most cases dynamic storage just works fine.
- Browse for the location of virtual disk.It is safe to use the default location until and unless required.Type a name for the hard disk. Select the size of hard disk(the size should be less than the hard disk size of your system i.e. if your system hard disk is of 120 GB then you should use less than 100 GB for virtual hard disk).This is the maximum size a dynamically expanding hard disk can have and it is fixed size of a hard disk
Installation Operating system on Virtualbox virtual machine
Installation method of operating systems on Virtualbox virtual machine is same as that of on normal systems.The installation process is simpler as you are using the whole virtual hard disk created above for installation.You can skip difficult step of formatting hard disk and continue with installation.
The only part important is selecting the installation ISO file or other file format supported.You can do so using below steps
- Select the option Settings of the virtual machine
- You will see Storage option in the next screen.
- On the storage tab you can see CD or DVD icon.Browse your file system to select ISO file of operating system to be installed on this virtual machine.
- Now you can start the virtual machine.It will boot as your normal system.
- Proceed with the installation as you would in case of normal system.
Installing Virtualbox guest additions
Vrtualbox ships with guest additions iso file.It contains pieces of software (you can also refer it as drivers) to make your guest operating system (one installed within Virtualbox virtual machine) more compatible with host system.
So first thing is to install guest additions after installing guest operating system.You need to boot your virtual machine.After starting virtual machine you can see Devices option.Under that option you can see Install Guest Additions option.Clicking on that option will mount guest additions iso file to cd drive of your virtual machine.
You can double click the right installer in that ISO file to install guest additions on your system.For example if your system is x86 64 bit then you need to choose that installer.For linux you need to mount your drive and use terminal to run ./installer file name.After installing guest additions restart your virtual machine to enable the changes.
Adding host folders to Virtualbox Virtual Machine
To access host folders and files (files and folders of operating system installed on your machine) from Virtualbox virtual machine follow below steps
- Go to the Devices option of the Virtualbox operating system window(virtualbox operating system window is window in which the virtual operating system boots)
- Click on the shared folder option.
- A window is displayed click on the top link to add a shared folder.
- On the next window click on the drop down(in front of folder name) and select other option see the figure below.
- A file browser window is opened.Select the directory of the host system which you want to access from the virtual machine.
- Select the option Make i.e. the folder is available after system reboot also. Permanent if you want to access this folder from virtual machine permanently.Select the option Read only of you don’t want to copy or write files or folders from your virtual machine into your host folder(the folder you are sharing)
Next We will see how to access these files and folders from Virtual Machine.We will use Shared Folders to denote files and folders shared by host system using above technique.
Accessing shared folders from Virtualbox Virtual Machine
To access shared folders from your windows virtual machine follow below steps
- Click on the START menu and then click on MY NETWORK PLACES.A windows pops up.
- Click on Add a Network place under Network tasks menu on the left side.
- Click on the NEXT button on popped up windows.Then on the next screen choose the option Choose another network location and click on NEXT.
- On this screen click on the browse button.
- A window Browse for Folder is displayed.Under the Entire Network you will see the option Virtualbox Shared Folders.
- Choose the folder you want to access and click ok.
- Next time onward you can view the folder icon at My Network Places.Just click on the folder and you can access the folder contents.
To access shared folders from your Linux virtual machine follow below steps
- Open the terminal and type command “su -” to use the terminal as the root user.
- use the command “mount -t vboxsf virtual-folder-name folder-name-for-mapping” in this command replace the virtual-folder-name with the name of host folder to be shared i.e. if host folder name id example then replace virtual-folder-name with example and folder-name-for-mapping is the folder on virtual operating system where this shared folder is to be mapped for example suppose you want to access shared folder from /mnt/shared then replace folder-name-for-mapping with /mnt/shared.
- Next time onwards you can use /mnt/shared to access the contents of shared folder.
Setting system date and time of Virtualbox virtual machine
System date and time are very important information. If your system date and time is not correct then you may face problems during internet browsing.To try this out set your time to any month and time of year 2008 like first January 2008 then browse internet.You will get invalid certificate errors (while trying to access gmail or any site which is https secured http).The reason is your browser takes the date information from your system.
Now if you are getting above issues while browsing internet from Virtual Machine then change system date and time of your virtual machine using below procedure
- Go to your host system (not the virtual machine)
- On the right hand bottom corner of your screen you will see date and time.Double click on that and in a new window you can change the information.Set it to current date and time.Save the changes.
- You can validate the change by looking at the information again.After validating proceed to next steps.
- The changed date and time will reflect in your virtual machine.
- The important point to note here is that you can not change your virtual machine date and time (you can change but it will automatically get set to host system date and time).
- Check your virtual machine to see the change.
Accessing USB on Virtualbox virtual machine
USB drives can be attached with virtual machines.You can also access Data Cards (wireless internet cards) also from virtual machine.To enable USB access from virtual machine follow below steps
- From Virtualbox startup screen click on the virtual machine you want to enable USB for
- Go to USB option inside Settings option of the Virtual machine
- Click on the USB option and make the changes as shown in the above picture.
Virtualbox is an excellent software.It does provide wide range of possibilities for a developer.One of the usage is installing Trial version of softwares on Virtual machine.You can re install the operating system on Virtual Machine after expiration of trial period.
Feel free to share this post and your thoughts.