From Mageia wiki
Jump to: navigation, search


This page is a draft. It requires improvements.

If you want to improve it, simply log in and click on the edit tab.
Please remove this {{Draft}} template, when you're sure the page is complete and correct.

View the other draft pages

View all other pages to improve and maintain.

VirtualBox is one of a number of hypervisors that allow you to run virtual machines on a Mageia system. VirtualBox is one of the easiest options for virtualisation and is fairly well used.

What to install

On the host

On your host, install the "virtualbox" package, and it will by dependency also pull in the virtualbox-kernel matching the kernel you have installed, and virtualbox-kernel-latest so it gets updated automatically in the future.

Oracle extension pack (optional)

VirtualBox has an Oracle extension pack which is required if you need support for USB2, USB3, PXE, multiple vCPUs, and a number of other features. However, this pack comes with a license agreement and is not shipped as part of Mageia.

You must find an extension pack with the same version number as virtualbox. On the download page you will find latest versions, plus older, and also read the info there.

Installing the Oracle extension pack

You will need the extension pack matching the version of VirtualBox. See https://www.virtualbox.org/wiki/Downloads .

After downloading the oracle extension pack, install the pack from the VirtualBox Manager, under Archive -> settings -> extensions. ... or use command line, see https://bugs.mageia.org/show_bug.cgi?id=18962

Don't forget to add yourself (user running VirtualBox Manager) to user group vboxusers in order to get access to USB2 etc. Also, you need to add yourself to group vboxsf if you want folder sharing with host to work. It also seems you need to reboot the host (or restart virtualbox?)

On guests

On the guests, if it is mageia, make sure dkms-vboxadditions is installed. This provides the guest with drivers for the virtualbox hardware, which improves performance and integration. Mageia installer seem to detect virtualbox host and install it automatically, but check!

When a new kernel is installed by updating with kernel...-latest, vboxadditions-kernel module will be installed and build against the newly installed kernel. However, this is not the case when a kernel is manually installed, you have also to install the specific vboxadditions-kernel. See mga#22684

For Microsoft Windows guests, after install, in the running guest virtual box window: Menu Devices -> Insert CD image of guest additions, and have the guest install it. (Virtualbox may download it automatically from Oracle if needed.)

Reaching Documentation

The VirtualBox home web page

The online user manual is really good. You should browse the Table of Contents. You find a pdf version at /usr/share/doc/virtualbox/UserManual.pdf after install of virtualbox-doc package (pulled by virtualbox package).

The VirtualBox forum have some tutorials.

Tips

Physical Main Board BIOS setting

Dont forget to check your main board BIOS have the setting (if any) for virtualisation enabled.

In the Host system

Add your user to the group vboxusers (for USB2/3 and more) and vboxfs (folder sharing with host)

In Virtualbox Manager

Creating the virtual machine

Most is self-explanatory, just select a name, go to defaults.

The virtual drive

Hint: Dynamically allocated drive = the size of it on your disk only grows as necessary up to the given limit, so you can create a "200 GB" drive as seen by the guest, but it only consumes a few GB after installing the guest. If you delete a lot of files in the guest it will not shink much, however, but there is a trick to do that: in guest clear unused space, and then let virtualbox compress it.

Settings on the virtual machine

Look around at the settings... I like this:

  • clipboard:bidirectional
  • drag'ndrop:bidirectional
  • Shared folders: share /home, auto-mount, permanent
  • for first boot, attach the iso file you downloaded (install DVD / Live DVD / network install boot.iso) to a virtual CD drive

Everything else is probably good as is by default and all can be changed later *except* some CPU related, depending on the guest system. You may want to increase graphics memory to max (128MB) and enable 2D acceleration. Maybe 2 CPU if you have more than that in host.. Maybe more RAM. Most modern OS like more than one CPU, I/O APIC, PAE/NX, VT-x/AMD-V, Nested Paging.

IMPORTANT: Some installers will install different kernels depending on ACPI, APIC, number of CPU, so it cannot be changed after the guest is installed!

(Example: WinXP installer will install different kernels depending on 1 or 2 CPUs are found at install.)

Better read: System settings

In the guest system

USB devices, CD, Network, and other devices

Use the dropdown "Devices" menu in VirtualBox window frame for the guest.

I.e connect your USB device, and after a couple seconds you can connect it to the guest by Devices->USB... and select it.

Auto shared folders

Shared folders with the host need guest additions, *and* add your user to the host system to the group vboxsf. If all works they will then be available in the guest system. See automatic mounting of shared folders

Special keystrokes

§ ctrl-alt-{F1, F2... Del, Backspace} is sent to guest by holding down host key (by default right Ctrl) instead of ctrl-alt.

§ Power button (ACPI off) is found in the menu of the virtual machine window.

Using a guest Mageia VDI

It is more and more frequent to use virtual disks (vdi) in order to directly access and use a new operating system. For example, in most Universities, students can download virtual disks for some operating systems, like linux distributions. For Mageia, there is a site named Osboxes from which you can download the latest Mageia 5 64bit virtual images. Steps are for example:

  • Open Virtual Box on your host and create a new guest. Select Linux and 64bit (for example Mandriva 64bit) and name it Mageia 5. With such a selection, the minimal memory will be set up. Click next and select "Open an existing virtual disk" and select the downloaded .vdi file.
  • On the Virtual Box application of your host, select Mageia 5 and start it. After a few seconds, you will have a running Mageia 5. Enter the password osboxes.org (be careful with the dot of your keyboard which might differ from the native English default keyboard).
  • Change the keyboard by using drakconf (Mageia Control Center), hadrware, select keyboard layout.
  • If your first network is a NAT, it can be useful to set the second network as a bridge: within the Virtual Box of your host, select Settings, Network, Second, Bridge. Reboot and see if your network works.
  • Add yourself as a new user in Mageia Control Center (keep osboxes until it is created) and go to the last boot section in order to setup autologin to yourself.
  • In order to download packages, go to Software Management and select Configure media sources for install and once it is done unselect the first two items related to CD.
  • Installing vboxadditions. Set a shared folder giving a path of your real machine to a shared folder (myhostdir) which will be "mounted" (api) on your Mageia guest. If you reboot, you will have an automounted (udisks2) media on /run/media/myloginame/VBOXADDITIONS_4.3.28_100309/VBoxLinuxAdditions.run but in order to run this binary as root you need to download the kernel devel rpm, for example: urpmi kernel-devel-3.19.8-desktop-3.mga5
Also, you need to add the group vboxsf to your username usermod -a -G vboxsf myloginame.
After rebooting you should see your host directory on /media/sf_myhostdir on the Mageia guest.

Special cases

Using LVM based disks

VirtualBox by default stores virtual disk images as files. If you have been using KVM, you may well have been storing your disk images as LVM volumes. To use LVM volumes with VirtualBox, you can create a vmdk file that points to the disk image, using a command like:

VBoxManage internalcommands createrawvmdk -filename /vbox/www.vmdk -rawdisk /dev/images/www

See: https://www.soljerome.com/blog/2010/09/07/using-lvm-volumes-with-virtualbox/ for details.