Virtualbox

From SHellium Wiki
Jump to: navigation, search
Geographylogo.png In other languages: English | Afrikaans | Albanian | Arabic | Brazilian | Bulgarian | Catalan | Chinese | Croatian | Czech | Danish | Dutch | Esperanto | Estonian | Filipino | Finnish | Flemish | French | German | Greek | Hebrew | Hindi | Hungarian | Indonesian | Italian | Japanese | Latvian | Lithuanian | Macedonian | Malay | Malayalam | Norwegian (Bokmål) | Norwegian (Nynorsk) | Persian | Polish | Portuguese | Romanian | Russian | Serbian | Slovak | Slovenian | Spanish | Swedish | Turkish | Ukrainian | Urdu

Warning.gif

This Feature Is Prohibited

If you attempt to use this on SHellium you will be banned.


The best way to learn linux (or anything) is by using it. For some people, installing into a dual-boot environment is not an acceptable option. For those people, virtualisation may be a viable solution. Virtualbox is a program that allows you to run the operating system of your choice in a virtual environment, making no change to your exisiting system or settings. For instance, you could run Ubuntu in a virtual machine, allowing you to boot and interact with it while still running Windows. It is similar to VMWare, and they share many features, although Virtualbox has some of its own as well.

Contents

Editions

There are two versions of Virtualbox available here, The open-source version (OSE), and the Personal Use and Evaluation License (PUEL) version. the PUEL version has several extra features not available on the OSE edition, including:

  • Remote Display Protocol (RDP) Server - a complete RDP server on top of the virtual hardware. This allows users to connect to the virtual machine remotely using any RDP compatible client
  • USB support - a virtual USB controller which allows USB 1.1 and USB 2.0 devices to be passed through to virtual machines
  • USB over RDP - a combination of the RDP server and USB support, allowing users to make USB devices available to virtual machines running remotely
  • iSCSI initiator - a builtin iSCSI initiator making it possible to use iSCSI targets as virtual disks without the guest requiring support for iSCSI

The version used in this howto will be PUEL.

Adding a Virtual Machine

Once you have downloaded and installed the executable from Virtualbox's website, you should have a link on your desktop that says "Sun xVM Virtualbox." Run it and you will be brought to the main screen. To create a new machine, click the toolbar button which says New. You will be brought to the New Machine Wizard. Here you will assign your virtual machine (VM) a name, amount of memory to be used, and hard disk image size (your virtual hard drive). In my case, I was installing Ubuntu, so I chose the name ubuntu, 512mb of memory, and a disk image of 10gb. Different operating systems will requite differing amounts of RAM, so check what the requirements for yours are and adjust accordingly. In any case, the RAM allocation should not be set to more than half of your host OS. Once you have completed the wizard, you should now see the name of your machine in the left-hand panel.

Dynamically expanding storage

When creating a new disk image, you are presented with two options, dynamically expanding storage or fixed-size storage. The difference between the two is that a fixed-size storage disk will create a file on your physical hard drive the same size the virtual hard drive you choose, ie a 10gb hard drive image for ubuntu will create a 10gb file on your physical hard drive, regardless of the actual size of the installed Ubuntu image. With dynamically expanding storage, the file on your physical hard drive will only be as large as the hard disk image, and will grow or shrink accoridingly until it reaches the limit you set. If you have trouble deciding between the two, just choose dynamically expanding.

Installing on the virtual machine

Mounting a CD or ISO

In order to install from an iso, in the right-hand pane you will need to click on CD/DVD-ROM. On the screen that pops up, click

Mount CD/DVD-ROM Drive

and select ISO image file. When you click the icon next to the textbox, you will be brought to the screen where you select the path to your iso file. Click Add, and select the path to the iso file you wish to install from, then click OK to go back to the main screen. If you wish to use your physical CD drive and a burned disc, simply select Host CD/DVD Drive and the correct drive letter.

Mounting a Physical Disk or Partition

Currently there is no way to create a VMDK for a full disk or partition using the GUI. It must be done on the command line using the following command, then attach it to any virtual machine.

VBoxManage internalcommands createrawvmdk -filename /path/to/vmdk_file -rawdisk /path/to/block_device -register

Note: On some Linux distributions you need will need to be a member of the 'disk' (or similar) group.

It is also possible to mount a raw disk image in Unix-like operating systems by creating a loopback device using losetup. This is especially useful if you created an image of a NTFS filesystem from a dying hard disk that will not mount without being chkdsk-ed first. On Linux this command will setup the device, and output it's path (e.g. /dev/loop0)

losetup -f --show /path/to/image_file

Now use the new loopback device as the block device in the VBoxManage command above. Do not forget to remove the VMDK from VirtualBox, and detach the loop device when finished.

Audio

To enable audio on the guest OS, click Audio in the right-hand pane, and click Enable Audio, and select your sound card device from the first drop down box. Once you have done this, click OK to go back to the main screen.

Networking and USB

If necessary, you can also change the network settings and USB recognition. This is handy if you would like bridged networking instead of NAT or have multiple network cards. Enabling USB will allow your virtual machine to access USB mounted devices, such as flash drives. It is not necessary to enable USB if all you need is a USB mouse or keyboard.

Once you have selected your install medium, and set audio/networking/usb as you would like it, the next step is to click Start on the toolbar. This will begin to boot your VM, and you will be able to proceed with the installation of your OS the same way that you would if you were doing it on your physical PC.

Guest Additions

Virtualbox comes with guest additions, which allow greater functionality between your guest and host OS. For instance, with guest additions you can have a seamless mouse between the two machines, eliminating the need to hit Right-Ctrl to release the mouse. It also allows for resizing of the guest OS, resulting in fullscreen without the need to change the resolution of the guest OS. Installation is accomplished by clicking the Devices menu on the machines toolbar, and selecting Install Guest Additions.... This will result in a CD being inserted into the VM (you will have to mount it manually in some linux flavours). It includes install binaries for different architectures, so make sure to run the right one. Once it completes, you will need to reboot your VM.

Snapshots

Virtualbox also includes support for snapshots, which will allow you to save the state of your VM and load it at a later date. This is ideal in case you suspect you are going to break something and don't want to reinstall, and serves the same basic purpose of a backup. Taking a snapshot is as easy as pressing Right-Ctrl S while the VM is running, or you can go to the Machine menu and select Take Snapshot. Snapshots are managed in the Snapshots tab on the right-pane of the main screen.

Hardware Acceleration

With the newest version of Virtualbox, 3D acceleration is experimentally enable. What this means for you is that if you have a video card capable of 3D rendering (most cards made in the last couple of years, if you have nvidia or ATI you will likely be fine), then you can enable Compiz and other 3D effects in your virtual machines. It is rather easy to do, and is accomplished by clicking the General link in the right-hand pane of the main screen. In the window that pops up, select Enable 3D Acceleration, and assign an appropriate amount of video memory. Press OK and you are done!

Personal tools
Namespaces

Variants
Actions
Navigation
Indexes
SHellium Sites
Toolbox