Difference between revisions of "VirtualBox"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m (Installing Virtualbox)
m (Installing Virtualbox)
Line 82: Line 82:
 
Update 2024:  On a Linux Mint 21.1 System adding the following to "Software Sources"
 
Update 2024:  On a Linux Mint 21.1 System adding the following to "Software Sources"
 
  deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib
 
  deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib
Then doing the keyring dance and apt update it was possible to install a version of virtualbox newer than what is available from the Mint/Ubuntu repositories.  At the time of this writing that is version 7.0.
+
Then doing the keyring dance and apt update it was possible to install a version of virtualbox newer than what is available from the Mint/Ubuntu repositories.  At the time of this writing that is version 7.0.  You have to replace the word "jammy" with the correct for your version of Ubuntu/Mint.
  
 
== Review ==
 
== Review ==

Revision as of 00:17, 18 February 2024

VirtualBox is virtualization host software that runs as an application on an established operating system. With VirtualBox you can install it on your existing Operating System and create and manage guest virtual machines, each with a guest operating system and its own virtual environment.

VirtualBox runs on Windows, Linux, Macintosh, and Solaris hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista, Windows 7, Windows 8), DOS/Windows 3.x, Linux (2.4, 2.6 and 3.x), Solaris and OpenSolaris, OS/2, and OpenBSD.

The core of VirtualBox is free software released under GNU General Public License version 2 (GPLv2).

Virtualbox-logo.png

Features

This is not a comprehensive list since virtualbox is truly very large in scope and capability.

  • Open Source.
  • Free Software.
  • 64-bit Guests.
  • Full Virtualization.
  • Linux, Windows, Mac, DOS, Novell, Solaris Guests.
  • Cross-Platform Host Support.
  • Guest SMP Support up to 32 vCPUs.
  • USB Support.
  • Full ACPI Support.
  • Dynamic Screen Resolutions.
  • iSCSI Storage Support.
  • PXE Network Booting.
  • Snapshot Support.
  • Remote Machine Display.
  • Extensible RDP Authentication.
  • USB over RDP.
  • Guest and Host Shared Folders.
  • Guest Additions ( Think VMware Tools).
  • Command Line Capability.
  • OVF Support.
  • VM Import/Export.
  • Thick and Thin Provisioning.
  • Wizard-driven VM Creation.
  • Easy to Install and Operate.

Interface Example:

Virtualbox-interface-ex95.jpg

Where to Obtain VirtualBox

  • Sun VirtualBox
  • Sun xVM VirtualBox
  • Innotek VirtualBox
  • Oracle VM VirtualBox

VirtualBox is currently maintained by Oracle company. This is because Oracle acquired Sun Microsystems in January 2010 and renamed Sun VirtualBox as "Oracle VM VirtualBox".

VirtualBox remains fully functional and free to use for personal use. Oracle defines personal use as any situation in which one person installs the software, and only that individual, and their friends and family, use the software. Oracle does not care if that use is for commercial or non-commercial purposes. Isn't that nice? There are, however, some "enhanced" features that are addons to VirtualBox that are not FOSS (Free Open Source Software.)

You can download VirtualBox directly from the Oracle VirtualBox web site. You may be required to register with an email address with Oracle, at no cost.

You can obtain some versions from the Robotz.com FTP site maintained by the Network Administration of this WiKi.

The Robotz.com FTP contains other virtualization software, clients, and drivers in addition to VirtualBox.

Installing Virtualbox

Linux: Debian / Ubuntu

You can install from apt-get or within the software center, however, if you want the latest version you have to get that from Oracle.

Oracle Latest Version of Virtualbox

Add the following line to your /etc/apt/sources.list:

deb http://download.virtualbox.org/virtualbox/debian trusty contrib

If you are using trusty-tar this will work, otherwise you need to change the word 'trusty' to match the reference the others are using inside the sources.list file. Just look around in there and you will see the name that you are supposed to use.

The Oracle public key is necessary to match and verify the download for the system. Type the following:

wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

To install VirtualBox, do

sudo apt-get update
sudo apt-get install virtualbox-5.0

Check to make sure that virtualbox-5.0 is still the latest version. It was at the time of this writing. You may have to change that package name to match the most current version available today.

Update 2024: On a Linux Mint 21.1 System adding the following to "Software Sources"

deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib

Then doing the keyring dance and apt update it was possible to install a version of virtualbox newer than what is available from the Mint/Ubuntu repositories. At the time of this writing that is version 7.0. You have to replace the word "jammy" with the correct for your version of Ubuntu/Mint.

Review

A full review coming soon...

VMware virtualization -vs- VirtualBox. The are clear advantages to VirtualBox including the FOSS license model.

VirtualBox UEFI does support Windows despite some misinformation published online. Writers like Manali Bhutiyani are erroneous in publishing that there is no support for UEFI. Support exists where needed and is under development where optional. Windows 8 and later work via UEFI in the latest VirtualBox 4.3 releases. Windows 32-bit versions have no UEFI support, however, it is not necessary. Windows 7 64-bit also lacks UEFI support, however, it is also not necessary. It can be disabled and Windows 7 64-bit will install and work correctly without UEFI on virtualization as the guest.

VirtualBox has been proven to run faster than VMware server. A timed experiment of an installation of Windows XP as the guest OS took 20 mins in VirtualBox and 35 mins on VMware server. A similar test on the booting time of the guest OS also shows favor to VirtualBox with a timing of 45 seconds compared to over twice as long on VMware server.

VirtualBox itself as a download is less than a quarter the size of the VMware installer. Also, VirtualBox has built-in support for remote file sharing. Networking is possible in a number of configurations to isolated test LANs and host bridging capabilities.

Basic Usage

hotkeys

First you need to know what key is defined as the HOST key. Typically the default HOST key is the RIGHT CONTROL KEY. The bottom right of the Virtualbox Running VM window will indicate the currently defined HOST key.

  • Switch to Fullscreen Mode -> HOST_KEY + F

share drive with host

To share a directory with the host for the purpose of moving files from one to the other you need to install a "Guest Additions" driver on the guest machine. This enabled a way to have a shared directory that is visible to the guest machine from the host machine. Guest Additions includes other features relating to sharing between host and guest.

To install Guest Additions: In this example the host computer is Ubuntu Linux and the guest computer is Windows 7.

Virtualbox-guestadd01.jpg

Choose "Insert Guest Additions CD Image" allows the Windows guest to think that a driver CD was just inserted into an attached cdrom drive containing the necessary driver.

Virtualbox-guestadd02.jpg

On the guest machine in Windows you can see that there appears to be a driver cd available.

Virtualbox-guestadd03.jpg

Open to browse the cd by right-click and select Open. Now locate VBoxWindowsAdditions.exe and right-click to Run as administrator. You must choose "Run as administrator" on the Windows 7 guest for the driver installer to proceed.

Virtualbox-guestadd04.jpg

Complete the driver installation process which will, at the end, require you to reboot the guest Windows 7 VM.

Once installed and your guest OS rebooted, you need to create a virtual shared folder. You can do this by going to Devices again and clicking on Shared Folders.

Now click on the Add New Shared Folder button on the right.

In the Folder Path box, click the down arrow and then click Other. Browse to the folder on the host OS that you would like to share with the guest OS. In the Folder Name box, give your share a name.

"auto-mount" versus "Make Permanent" -

By ticking Auto-mount the folder will always be mounted in the Ubuntu guest directory /media/sf_myshares (the prefix sf_ will automatically be added).

By ticking Make Permanent the shared folders will also be available on the next boot and will be mounted when Auto-mount is ticked in addition.

network options

Network "Attached to" options:

  • Not attached - simulates NIC w/o attached cable
  • NAT - default to access external network, separating by a simulated router
  • NAT Network -
  • Bridged Adapter - circumvent host network stack, direct to network
  • Internal Network - simulated tiny LAN not visible to host or real network
  • Host-only Adapter - similar to Internal Network w/o use of host NIC
  • Generic Driver - UDP tunnel or VDE

Scenario 1: you need the guest to have access to the Internet while being on a different subnet from your LAN. Choose: NAT

Scenario 2: you need access to the host system via Guest Additions, however, you do not want the guest OS to have any access to the Internet. Choose: Host-only Adapter.

support

Online User Manual

The link is: Oracle VM VirtualBox User Manual

Increase size of virtual disk

Applies to a virtual drive VDI file. Use the command 'VBoxManage' as this must be done from the console (MS-DOS prompt). For Windows XP the VBoxManage is not in the path by default, and the default base directory is Program Files. The space causes an error. To avoid, the following example is provided for Windows XP users:

C:\Progra~1\Oracle\VirtualBox\VBoxManage modifyhd "Win XP SP3 Image.vdi" --resize 45888

note: You will need to navigate to the path that contains your vdi file prior to execution of the command above! In Windows XP these are typically in a subdirectory of the following:

C:\Documents and Settings\<username>\VirtualBox VMs

Here the VBoxManage command is used to resize a 10GB image to 45GB. The quotes around the image name prevent an error due to the spaces. The use of the 8 char substitute Progra~1 prevents an error.

If you were viewing the virtual drive in Virtual Media Manager GUI, you will have to exit out and close Oracle VM VirtualBox Manager. When you open it again you will see the new size.

For Windows XP if you now start the virtual machine and goto Administrative Tools, Computer Management, Disk Management you will notice unpartitioned space. You can create a new drive letter second partition on the space. If you prefer to increase the primary partition for Windows XP you will need a 3rd party tool such as GParted via Gnome Partition Editor (download the ISO, mount it and boot from it when starting the partition. First load the VM/Win XP, on the VM menu choose Devices, CD/DVD devices, and mount the ISO of Gnome Partition Editor. Shutdown the VM. VM Settings, System, Boot Order, CD/DVD and boot Gnome Partition Editor.) Link: GParted Live CD

Howto Register and Load a vdi Image

Create a new virtual machine: in “VM Name and OS Type”, choose one of “Linux”, “BSD” or whatever matches your OS. Choose the profile that best fits your image in “Version” (for example, if you downloaded an Ubuntu virtual disk image, choose the “Linux” and “Ubuntu” pair). If you have a disk image of a Linux distribution not shown in the drop down list, choose “Linux 2.6″ or “Linux 2.6 (64 bit)” Try to find and use the best possible match for the host operating system within the image file. For memory size you can use the default or add more depending on your needs. Probably use no less than 512MB. On the Hard drive screen it is important that you select USE EXISTING HARD DISK and click the folder image to browse and select your vdi image file.

Example A: For Android image AndroidLive01

  1. Name and Operating System: type Linux, version Linux 2.6
  2. Memory Size: 512MB
  3. Hard drive: Under virtual hard disk, select Use existing hard disk option and browse for AndroidLive01.vdi
  4. Click CREATE

Make VM available from different user accounts on one computer

First you have to locate the virtual hard drive of the shared machine in a directory where different users have appropriate permissions. By default VirtualBox puts the VMs in your home directory in a path like:

/home/username/VirtualBox VMs

This can be moved to a location where all users have permission to access the VMs.

Make the VirtualBox VMs directory under /home so all users can access it.

mkdir /home/VirtualBox\ VMs
groupadd vboxusers
usermod -aG vboxusers nicolep 

We created a group vboxusers and added a user nicolep to the group.

For all VMs we can chgrp vboxusers * and chmod 775 *

To change default folder on GUI client: File -> Preferences -> General and with command line:

VBoxManage setproperty machinefolder /home/VirtualBox\ VMs

For existing VMs the second user will not be able to see those created under the first user's x.org login session because VirtualBox has a configuration file that lists the VMs. If user 1 is Joe and user 2 is Nicole, we want to make it so Nicole can use Joe's VMs.

cp /home/joe/.config/VirtualBox/VirtualBox.xml /home/nicole/.config/VirtualBox/VirtualBox.xml

Now they both have the same list of VMs.

Next problem is permissions. Every time Joe opens a VM under his login, the permissions get changed locking Nicole out. VirtualBox takes ownership of the VM and changes the permissions resulting in the following error afterwards when you switch user accounts.

Virtualbox-warning-permissions.jpg

The commands have to be manually entered again.

cd /home/VirtualBox\ VMs
chgrp vboxusers * -R
chmod 775 * -R

Having to change the permissions back each time you login as the other user is not desirable. There are some workarounds suggested by sources online.

See other comments in the discussion tab.

GUESTADDONS DOES NOT WORK IN CONSOLE ONLY, REQUIRES X.ORG

actually: it is said that you can do it in console only.

all of this is moot......................... On the GUEST when it is CentOS:

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm
yum install dkms

Now go to the menu: Devices -> CD/DVD Devices -> Choose a virtual CD/DVD disk file... select: VBoxGuestAdditions_2_2.0.iso

mkdir /mnt/cdrom
mount /dev/scd0 /mnt/cdrom
yum install dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel

ref: https://forums.virtualbox.org/viewtopic.php?f=7&t=67631

USB 2.0 Support

This requires the installation of Oracle VM VirtualBox Extension Pack. The procedure here has been tested on VirtualBox 4.3.10 on 14.04.1 LTS _Trusty Tahr

To see what extension packs you may already have installed type this command:

sudo VBoxManage list extpacks

To download goto:

Scroll down the page to find the version that matches what you have. For this example the correct one was found on page 2 under: "VirtualBox 4.3.10 (released Mar 25th 2014)". Click on "Extension Pack All Platforms"

  • Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack

YOU MUST DOWNLOAD THE EXTENSION PACK VERSION THAT MATCHES YOUR VIRTUALBOX INSTALL VERSION

Goto the file and right click, choose to open in VirtualBox. You will be prompted to install the extension. After initiating installation you will see an install progress dialog box. KDESudo will prompt you for your password. This prompt opens behind the current window and sometimes cannot be seen. If the install progress indicator is not moving it is probably because you have been prompted to enter the password for sudo, and the dialog is hidden behind the current window.

If successful, the dialog will display: The extension pack Oracle VM VirtualBox Extension Pack was installed successfully.

note: if you install the wrong version then you need to remove it before proceeding. Use the following command to remove any defunct or incorrect version

 vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"

Online Resources

Download Free VirtualBox Images

Many VirtualBox images, complete with installed operating systems, are available for download from the website

These are images containing free, open source, or free to share operating systems and software only.