VirtualBox

From MEPIS Documentation Wiki

Jump to: navigation, search

Contents

Required knowledge

  • Opening a console and issuing simple commands
  • Copy and Paste

Introduction

VirtualBox is a software package that allows you to run another OS from within MEPIS, in a so called Virtual Machine (VM). Of course, there are other VM solutions, but VirtualBox has some outstanding characteristics:

  • Almost completely Open Source (except for some addons)
  • Easy installation
  • For Linux and Windows host systems
  • Linux, PC BSD and Windows guest systems
  • Very fast and lightweight

For examples of how you might use it, consider that you can install beta-test versions of MEPIS in a VM. This is especially useful, in that you can even SKIP the whole step of burning the ISO file onto a CD, because VirtualBox supports the ability to install directly from the ISO-file. [See the details below, in the 'Using an ISO' section.] And, of course, you can also try out some other Linux distro this same way.

In fact, you can convert any install-CD that was made from an ISO-file, back into an ISO-file, by doing a 'rip' of it. This includes Windows-install-CDs. Use a cmd of the form:

dd if=/dev/cdrom of=my_win_kit.iso

[Yes, it's legal to do that...the Microsoft protection gets enforced LATER, during the installation, when you are asked for a valid 'product-key'. OEMs backup their kits this way, to guard against scratches on their media copy.]

Preparations for installation

To prepare MEPIS for installation of VirtualBox, you need to install a couple of required packages. Act as follows:

Open a console --> type "su" and enter root password --> paste this command into the console:

m-a prepare

Done. We can now proceed to get VirtualBox and install it.

Installation

MEPIS 8

Add this line in /etc/apt/sources.list (use Synaptic or edit it as root in a terminal with any text editor)

deb http://download.virtualbox.org/virtualbox/debian lenny non-free

Run this command as root to add the Sun public key:

wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O - | apt-key add -

Update sources:

apt-get update

Install VirtualBox with this command:

apt-get install virtualbox-3.0

When it asks "Should the vboxdrv kernel module be compiled now?", you can say Yes.

MEPIS 7

As of mid-June, 2008, Sun Microsystems has disabled the repository supplied with MEPIS 7. You now must manually download the package from this page (choose the Etch version for MEPIS 7)

Important: before installation, you need to run "m-a prepare".

MEPIS 6.x

Go to the VirtualBox website and download from this link. Make sure you get the correct binary package. If you use MEPIS 6.x, you need to get Ubuntu 6.06 LTS ("Dapper Drake"). For MEPIS 7, you need to get Debian 4.0 ("Etch") version.

When the package is downloaded, open Konqueror and go to the folder where you saved the VirtualBox package. Press F4 to open a console in that folder. We are now going to install it via the command line.

  dpkg -i virtualbox*.deb

Please note that your actual package name may differ. To avoid problems with the name, start typing dpkg -i virtual and then enter a TAB. This will autocomplete the command.

The package will now be installed. At one time, it will ask you if you want to compile the kernel module. Just answer yes and the module will be created automatically.

Post installation

Once the package is installed, you need to reboot. If you don't do that, you can only run it as root. After a reboot you should be able to run VirtualBox in your regular user account. Virtual Machines will be created in ~/.VirtualBox.

You might have to add your username to the user group "vboxusers". To do this, launch KUser by clicking KMenu --> System --> More Applications --> User Manager (KUser). If you prefer the command line or you're using antiX, as root, execute

   usermod -G vboxusers -a username

insert 'username' with your name. Log out and log back in for changes to take affect.

Settings

New machine

To launch the program from the cmd-line, enter "VirtualBox" (without quotes, note the mixed-case). To launch via KDE window-manager, you should be able to find it in the menu-system under "Applications-> System->Virtual Machine".

To create a new virtual machine, click the NEW icon on VirtualBox's toolbar. You will be guided in creating a virtual machine.
If you are installing MEPIS as a Virtual Machine: when it asks for "OS type" and "Version", MEPIS is not in the dropdown list. Since it is informational only, you can use OS type = "Linux" and Version = "Debian" or any other choice you are comfortable with.

[Note: As an example, to install Win-XP Pro into a VM, you will probably need to follow a detailed example tutorial. One such tutorial can be found at: http://ubuntuforums.org/showthread.php?t=433359 Other examples can be found by doing a Google-search using keywords like: 'virtualbox tutorial Windows'.]

Once created and before booting a VM, you can tweak the settings by clicking on the appropriate item on the right side of the VirtualBox screen. Settings such as System memory, video memory, Audio and others can be refined here.

For example, audio should be set to what your host is using such as alsa. Slow and unresponsive VM's can be improved by increasing system memory, but do not set it too large or it will be counterproductive. A setting of 356 MB seems to work fine for most Linux distros on a 1 MB machine. In other words, a good rule of thumb for starters would be to keep 2/3 of memory for the host machine and give 1/3 of memory to this virtual (aka guest) machine and then tweak/tune this later as needed.

Using an ISO

A nice feature (and an essential one on machines without a CDROM drive) is to set the CDROM to virtual and specify an iso file of the Linux distro you want to install into a VM. It will then boot directly from the iso file into your VM and you can install permanently (for those LiveCD's having an install feature). [This is a great way to test MEPIS-beta/RC kits.] Remember to check the physical CDROM box before booting into your install, or 'no CDROM' for machines without a physical drive.

Guest Additions

Important tip: Be sure to install VirtualBox GuestAdditions to your Guest OS, from the .iso file that is included with your VirtualBox installation. This will allow you to:

  • link one or more folders on the hard disk, which are accessible from the Host OS, with the virtual network installed in the Guest OS. This enables sharing files between Guest and Host.
  • adjust your display in various ways so that it suits your environment and habits

There are other features that are enabled with VirtualBox GuestAdditions (see product documentation).

Use USB devices in the virtual machine

  1. Make sure you use the full edition from Sun not the OSE (Open Source Edition) edition that Debian provides.
  2. Make sure you check "Enable USB Controller" in VM settings.
  3. If the USB devices still appear grayed out, add this line to /etc/fstab file (in the static part of it, the part before "Dynamic entries below" line):
none /proc/bus/usb usbfs devgid=46,devmode=664 0 0

Documentation

Don't forget to get the excellent User Documentation. There you will find info regarding host shares, how to install the VirtualBox addons (for better screen resolution and mouse integration) and loads more.

Troubleshooting

If you get a message saying "VirtualBox kernel driver not accessible, permission problem" when starting VirtualBox right after installation, your user account is probably not listed in the vboxusers group. The installation takes care of creating that group, but you will need to manually add all users to it that should be allowed to run VirtualBox.

As root, for each such user, run

usermod -G vboxusers -a username

If you replaced the kernel you need to run these commands:

m-a prepare
/etc/init.d/vboxdrv setup

Useful Links

Personal tools
In other languages