An Introduction to Oracle's Virtual Box (VBox)

D

DevynCJohnson

Guest
Many computer users have heard of a virtual machine or a virtual OS. This is special software that allows users to run an operating system inside of another. In this tutorial, I will install AnitaOS in a virtual machine on my Ubuntu system. AnitaOS would be called the guest OS and Ubuntu is the host system.

Many virtual machines exist. I will use Oracle's VirtualBox (VBox) because it is a cross-platform software that works on most hardware. Other virtual machines (VM) require special kernel modifications or special BIOS updates. Virtual-Box is open-source and works on many systems including (but not limited to) Solaris and Windows (obviously, it works on Linux since this article originated from Linux.org).

Download a compiled Virtual-Box:
https://www.virtualbox.org/wiki/Downloads
Source Code (src): https://www.virtualbox.org/browser/vbox/trunk

Once you have downloaded VirtualBox, make sure you have your desired guest-OS installation medium. This may be an image file, like an ISO, or a physical disc. Also, make sure you have at least ten Gigabytes (or more for larger guests) on one partition. For this tutorial, I am using AnitaOS, but this will work for any guest like Solaris, *BSD, Linux, Windows, etc.

Open VirtualBox and click "New".

vb_01.png


vb_02.png


Then, name the guest. Usually, users type the name of the OS. Any name will work. For "Type", choose the general category of your guest. For operating systems like Plan 9, BeOS, Haiku, Inferno, and most Unix and Unix-like systems, place them under "Other". AnitaOS is a Linux distro that is based on Puppy Linux, so I will click "Linux". Under "Version" choose the one that best describes your system. Do not worry about choosing the "right" one. The purpose of this is for VirtualBox to make suggestions in the settings and for sorting guests operating systems in the list of detected guests.

vb_04.png


NOTE: You can have as many guest operating systems as you wish as long as you have the storage space to store the virtual hard-drive files.

Next, set the amount of memory that will be reserved for the guest. Be careful not to set this too high. The host cannot use the memory that is reserved for the guest. I will set this to 512MB.

vb_05.png


After that, a virtual hard-drive needs to be setup. This is an image file (like an ISO). After "Create" is clicked, a list of virtual hard-drive formats are listed. Since I am using VirtualBox, I will choose "VDI" which is VirtualBox's standard/default format. Users would choose a different format if they have specific needs or plan to use the guest on various virtual machine software.

vb_06.png


vb_07.png


NOTE: The virtual hard-drive file containing the guest is often referred to as a virtual appliance. Most virtual machine software allows users to import guest systems by “importing an appliance”.

Next, the user can make a fixed or dynamic virtual hard-drive. Fixed-size sets the file's size to the specified virtual hard-drive size while dynamic expands as needed until the maximum size is met. I will choose "Fixed size".

vb_09.png


On the following window, set the size and location of the file. I will make this file 8GB. After clicking "Create", this may take some time.

vb_10.png


Once the virtual hard-drive has been created, click "Settings". A window will appear with tabs and a list on the left side. Most of the settings are self-explanatory, but I want to point out the important or difficult to understand options. In the "General" window in the "Advanced" tab, there is a drop-down titled "Shared Clipboard". With this, you can set how the clipboard's contents are shared. "Bidirectional" means both the guest's and host's clipboard are one. The most recent item on either clipboard will be copied to the other.

vb_12.png


vb_13.png


Under "System > Motherboard", you can change the amount of reserved memory. Here is an important setting to remember - the "Boot Order". Change this according to your needs. The priority is set as the most important/first device on the top and the least important on the bottom. Unchecked items will be ignored. Since I still need to install AnitaOS, I will place the CD-ROM on the top.

vb_14.png


Under the "Processor" tab contains a setting to control how many of the processor the guest can use and the maximum execution cap. This means a user can set the guest to only use 60% of the CPU resources or what ever amount they wish.

vb_15.png


Under "Display > Video", the user can set how much of the guest's memory to reserve for video. I set mine to 64MB for AnitaOS. Video acceleration can also be set. Generally, video acceleration is not needed for many systems.

vb_16.png


Under "Storage", you can select your installation medium. Click the "Empty" disc and then the small disc icon near "CD/DVD Drive". If your installation medium is a physical disc, then choose "Host Drive". Otherwise, click the "virtual disc" and browse for your ISO file or any other accepted format.

vb_17.png


Audio can be enabled/disabled under "Audio".

vb_18.png


Under "Network", you can configure and set the networks for the guest. The "Bridged Adapter" allows the guest to use a network adapter used by the host. Yes, the guest and host can safely share and use the same network cards at the same time. So, to make the guest use my wireless card, I set the "Attached to" to "Bridged Adapter". The "Name" will then be set to "wlan0". This virtual machine can handle up to four network adapters.

vb_19.png


The guest can be set to use certain directories that are on the host system. Most guest systems see such shared folders as mounted drives.

Once you have made the changes you want, click okay and then click "Start" on the main screen. Then, the guest operating system starts up. Install your system as you would on real hardware.

vb_20.png


Once your guest finishes installing and you shut it down, remember to go back to the boot order settings and make the hard-drive the top priority. Otherwise, your installation medium will boot first.

Now, with this knowledge, users can experiment with other Linux distros, Unix, Unix-like systems, and what ever else they wish. Enjoy!
 

Attachments

  • slide.jpg
    slide.jpg
    73 KB · Views: 220,812
  • vb_11.png
    vb_11.png
    181.7 KB · Views: 1,511


Remember that if you're installing a 64Bit guest you need to select 64Bit under the version dropdown in the same panel where you name the guest OS. Otherwise the guest will hang when you try to start it.

You will see the following in the panel that says Name and operating system
Name:
Type:
Version: <-- This is where you make the change.
 
Hi
Thanx for this article.

Question:
Can I run more than one vm? and is it possible to import/export files directly from vm (A) to say, vm (B). (on the same PC)

Yes, as long as you have plenty of resources (RAM, CPU, etc.) you can have as many active VMs as you wish. As far as VM networking, I have heard of people doing it, but I do not know how. Good questions!
 
Remember that if you're installing a 64Bit guest you need to select 64Bit under the version dropdown in the same panel where you name the guest OS. Otherwise the guest will hang when you try to start it.

You will see the following in the panel that says Name and operating system
Name:
Type:
Version: <-- This is where you make the change.

Thanks for sharing that important info.
 
Great article! I just have a question or two before getting started. You wrote
Also, make sure you have at least ten Gigabytes (or more for larger guests) on one partition.

1)What type of partition? I am not quite a command line level, so I use the GUI for my partitioning tool. I would like to set up space and create a VM. What type of partition do I do? Do I just create "unallocated" space and leave it unformatted? Do I create a new "extended" partition and then when I am going through the tutorial it sets up the OS just like I would be when I created my dual boot? (I unallocated space and installed Linux on that space and formatted and set the / partition along with /swap and /home during the installation)

2) After I create the VM, every time I want to use it, do I need to boot if off the install medium that I am using to create the VM or to I just pull up VituralBox and it will give me an option of an already created VM?

I know I am probably asking really dumb questions, I just want to understand more fully. :)
 
Great article! I just have a question or two before getting started. You wrote


1)What type of partition?

2) After I create the VM, every time I want to use it, do I need to boot if off the install medium that I am using to create the VM or to I just pull up VituralBox and it will give me an option of an already created VM?

The virtual hard-drives can be placed anywhere. The partition that I am referring to is just any partition you would not mind placing these large files.

As for booting the VM, open VirtualBox and select the desired virtual machine.
 
:DI have mine partitioned (Win) but hey 100 Gb and *Gb is nice i like using them too im killer with win but hello linuxers
 


Top