Virtual Machines With VB

This guide explains how you can run virtual machines with Sun VirtualBox 3.1.x (NOT OSE version!) on a headless blackPanther Server install.
Normally you use the VirtualBox GUI to manage your virtual machines, but a server does not have a desktop environment. Fortunately,
VirtualBox comes with a tool called VBoxHeadless that allows you to connect to the virtual machines over a remote desktop connection,
so there’s no need for the VirtualBox GUI.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

I have tested this on a blackPanther Server (host system) with the IP address where I’m logged in as a normal user
(user name administrator in this example) instead of as root.
If you only have a root account, but no normal user account, create one as follows (user administrator, group administrator)…

# groupadd administrator
# useradd -d /home/administrator -m -g administrator -s /bin/bash administrator

… create a password for the new user…

# passwd administrator

… and log in as that user.

2 Installing VirtualBox

To install VirtualBox 3.1.x on our blackPanther Server, we need root privileges, therefore we run

$ su

Then we install the dependencies for VirtualBox 3.1.x as follows (if not installed):

# installing wget flex gcc gcc-c++ kernel-devel kernel-headers dkms

Next we pick the right VirtualBox package from; pick the i386 or AMD64 package (depending on your architecture) for blackPanther OS . (you can find out your architecture by running , good choice the Mandriva or Redhat RPM packages)

… and download it as follows:

# wget -o /tmp/VirtualBox-3.2-3.2.8_64453_mdv2009.1-1.i586.rpm

To check package

# ls  -l  VirtualBox*.rpm
[root@server1 tmp]# ls -l VirtualBox*.rpm
-rw-r–r– 1 root root 42991260 2010-08-06 15:14 VirtualBox-3.2-3.2.8_64453_mdv2009.1-1.i586.rpm

[root@server1 tmp]#

Afterwards, we install VirtualBox 3.x as follows:
# installing VirtualBox-3.2-3.2.8_64453_mdv2009.1-1.i586.rpm

Now we must add the user that will run VirtualBox (administrator in this example) to the vboxusers group:

# /usr/sbin/usermod -G vboxusers administrator

VirtualBox is now installed and ready to be used.


# exit

to leave the root account and become a normal user (administrator) again.

3 Using VirtualBox On The Command Line

3.1 Creating A VM

To create a VM on the command line, we can use the VBoxManage command. See

$ VBoxManage --help

for a list of available switches and (highly recommended!) take a look at

I will now create an blackPanther Virtual System VM with 256MB memory and a 10GB hard drive from the blackPanther Virtual System iso image (to_usage.iso example: blackPantherOS-v10.1.1-CD.iso).

The easy solutions the automated script. Download here:

# cd /tmp

# wget

To run the script enter following command

# sh /path/to/to_usage.iso

3.2 Importing An Existing VM

Let's assume you have a VM called examplevm that you want to reuse on this host.

On the old host, you should have a directory Machines/examplevm in the VirtualBox directory; Machines/examplevm should contain the examplevm.xml file.

Copy the examplevm directory (including the examplevm.xml file) to your new Machines directory (if your user name is administrator,

this is/home/administrator/.VirtualBox/Machines - the result should be /home/administrator/.VirtualBox/Machines/examplevm/examplevm.xml).

In addition to that copy the examplevm.vdi file from the old VDI directory to the new one (e.g. /home/administrator/.VirtualBox/VDI/examplevm.vdi).

Afterwards, you must register the imported VM:

$ VBoxManage registervm Machines/examplevm/examplevm.xml

3.3 Starting A VM With VBoxHeadless

Regardless of if you create a new VM or import and old one, you can start it with the command:

$ VBoxHeadless --startvm "blackPanther Virtual System"

(Replace blackPanther Virtual System with the name of your VM.)

VBoxHeadless will start the VM and a VRDP (VirtualBox Remote Desktop Protocol) server which allows you to see

the VM's output remotely on another machine.

To stop a VM, run

$ VBoxManage controlvm "blackPanther Virtual System " poweroff

To pause a VM, run

$ VBoxManage controlvm "blackPanther Virtual System " pause

To reset a VM, run

$ VBoxManage controlvm "blackPanther Virtual System " reset

To learn more about VBoxHeadless, take a look at

$ VBoxHeadless --help

and at

4 Connecting To A VM From A Remote Desktop

4.1 Windows XP

You can use the built-in Remote Desktop Connection utility to connect to the VM:

Type in the hostname or IP address of the host (not the guest!):

And voilà, you should be connected to the VM:

4.2 Linux

Use krdc or rdesktop to connect..

About the Author

7 thoughts on “Virtual Machines With VB

  1. This is the greatest information that I’ve learn, appreciation so a great deal for giving it to me!

  2. I’m here by accident. I started reading and I should tell you that your blog is great. You are writing so many interesting things. I disagree with many of them, but it’s ok. I will probably visit your site more often. I would like to use your words on my own blog. Can I?May I? – Marta

  3. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy.

  4. You completed a number of fine points there. I did a search on the subject and found a good number of people will have the same opinion with your blog.

  5. Personally I’m impressed by the quality of this. Generally when I come across these sort of things I like to post them on Digg. This article probably won’t do well with that crowd. I’ll take a look around your site though and submit something else.

Comments are closed.

You may also like these