Linux virtualization - Setup virtualbox in Slackware

A virtualization in Linux has several meanings. The Linux virtualization term, as used by Novell, is consolidate workloads running on multiple physical servers onto a single physical server. The other meaning of Linux virtualization is installing another operating system on top of the current Linux operating system, which is known as native virtualization. You probably have heard about virtual pc and vmware in Windows environment. Those are virtualization software, which allow other operating system to be installed in the current operating system. They act as an interface between host and guest operating system.

This tutorial is about the native virtualization, installing a guest operating system in our current Linux. We are going to use Sun's Virtualbox virtualization software instead of VMware. Virtualbox is the only open source virtualization software available at the moment.

These are all steps needed to properly install Virtualbox in Slackware:

  1. Install ACPI Component Architecture (acpica).
  2. Download virtualbox-ose slackbuild scripts.
  3. Compile VirtualBox Open Source Edition.
  4. Install VirtualBox Open Source Edition Slackware package.
  5. Checking and testing Virtualbox

You can check the How to install The ACPI Component Architecture (ACPICA) in Linux tutorial for a guide. When you finished the acpica installation, create a symbolic link for iasl in the /usr/share and /usr/bin directories.

[email protected]:~# cd /usr/share/
[email protected]:~# ln -s /usr/local/src/acpica-unix-20081204/compiler/iasl
[email protected]:/usr/share# cd ../bin/
[email protected]:/usr/bin# ln -s /usr/local/src/acpica-unix-20081204/compiler/iasl

Prepare Slackware build environment

To prepare the Slackware build environment, we are going to create several directories to keep sources and build packages. This step is not mandatory but it's necessary to keep our system clean. These are directories suggested by Slackbuilds dot com:

  • /home/slackware - A dedicated directory for Slackware build environment.
  • /home/slackware/source - To keep all Slackware sources to be build.
  • /home/slackware/source/myslackware/
    - Build package here.
  • /home/slackware/packages - Keep all finished packages.

Create a group for build environment. Add user for this group to build and manage Slackware build environment. Here is an example:

[email protected]:~# groupadd packager
[email protected]:~# usermod -G packager luzar
[email protected]:~# groups luzar
luzar : users packager

Change group owner for /home/slackware directory and sub-directories.

[email protected]:~# chown -R root.packager /home/slackware/

Download slackbuild scripts for VirtualBox Open Source Edition

Slackbuilds dot org team has developed many slackbuild scripts to build packages for Slackware. Download slackbuild script for virtualbox-ose from slackbuild dot org repository and move it to the /home/slackware/source/myslackware directory.

Install VirtualBox Open Source Edition

Download VirtualBox Open Source Edition source from Virtualbox website and move it to /home/slackware/source directory.

Download Virtualbox Additions iso and user manual from Virtualbox website and .

Add the script below in the /etc/rc.d/rc.local.

[email protected]:~# cat /etc/rc.d/rc.local
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

# Start vboxdrv
if [-x /etc/rc.d/rc.vboxdrv]; then
/etc/rc.d/rc.vboxdrv start
fi

# Start vboxnet
if [-x /etc/rc.d/rc.vboxnet]; then
/etc/rc.d/rc.vboxnet start
fi
[email protected]:~#

Create /etc/rc.d/rc.local_shutdown and add the script below.

[email protected]:~# cat /etc/rc.d/rc.local_shutdown
# Stop vboxdrv
if [-x /etc/rc.d/rc.vboxdrv]; then
/etc/rc.d/rc.vboxdrv stop
fi

# Stop vboxnet
if [-x /etc/rc.d/rc.vboxnet]; then
/etc/rc.d/rc.vboxnet stop
fi
[email protected]:~#

Make rc.local_shutdown executable.

[email protected]:~# chmod 755 /etc/rc.d/rc.local_shutdown

The Virtualbox need a group owner vboxusers. So create vboxusers group:

[email protected]:~# groupadd -g 103 vboxusers

Add user to the group:

[email protected]:~# usermod -G packager, vboxusers luzar
[email protected]:~# groups luzar
luzar : users packager vboxusers

Extract virtualbox-ose.tar.gz.

[email protected]:~# cd /home/slackware/source/myslackware/
[email protected]:/home/slackware/source/myslackware# ls
virtualbox-ose.tar.gz
[email protected]:/home/slackware/source/myslackware# tar zxvf virtualbox-ose.tar.gz
[email protected]:/home/slackware/source/myslackware# ls
virtualbox-ose/ virtualbox-ose.tar.gz

Copy the /home/slackware/source/VirtualBox-2.0.6-OSE.tar.bz2 source, Virtualbox Additions iso and user manual file to the virtualbox-ose directory, the extracted build directory.

[email protected]:~# cp /home/slackware/source/VirtualBox-2.0.6-OSE.tar.bz2
/home/slackware/source/myslackware/virtualbox-ose/

[email protected]:~# cd /home/luzar/Desktop/
[email protected]:/home/luzar/Desktop# mv VBoxGuestAdditions_2.0.6.iso
/home/slackware/source/myslackware/virtualbox-ose

[email protected]:/home/luzar/Desktop# mv UserManual.pdf
/home/slackware/source/myslackware/virtualbox-ose

Run the slackbuild script.

[email protected]:~# cd /home/slackware/source/myslackware/virtualbox-ose/
[email protected]:/home/slackware/source/myslackware/virtualbox-ose# ./virtualbox-ose.SlackBuild

Slackbuild install complete image

If the package compiled successfully, the result can be found in /tmp directory.

Compile result image

Copy the result package in /tmp directory to the /home/slackware/packages.

[email protected]:~# cp /tmp/virtualbox-ose-2.0.6-i486-2_SBo.tgz /home/slackware/packages/

Install VirtualBox Open Source Edition Slackware package

We can install our new Slackware Virtualbox package using installpkg or pkgtool.

[email protected]slackware:/tmp# installpkg virtualbox-ose-2.0.6-i486-2_SBo.tgz

Checking and testing Virtualbox

We can check Virtual package has been successfully installed with pkgtool View option.

pkgtool view installed package image

Finally, we can open Virtualbox with kde.

Image

Although the virtualbox is already there, we still can't install guest operating system. We have to prepare a kernel driver for the new operating system we are going to install. Let's say we want to install Ubuntu server 8.10 as a guest, we need to create a base kernel driver for Ubuntu first.

Download suplementary kernel driver for the VirtualBox virtualisation environment from Slackbuilds dot org:

What we have to do now is just repeat the virtualbox installation steps above. For your convenient, here's the list:

  1. Place the virtualbox-kernel source in /home/slackware/source.
  2. Move the slackbuild virtualbox-kernel in /home/slackware/source/myslackware.
  3. Untar slackbuild virtualbox-kernel in /home/slackware/source/myslackware.
  4. Copy the virtualbox-kernel source in /home/slackware/source into the untar slackbuild virtualbox-kernel in /home/slackware/source/myslackware.
  5. Make virtualbox-kernel.SlackBuild executable. Use chmod 755 virtualbox-kernel.SlackBuild.
  6. Run virtualbox-kernel.SlackBuild with kernel version of your choice. For example, Ubuntu 8.10 uses 2.6.26, so you can run: KERNEL=2.6.26 ./virtualbox-kernel.SlackBuild
  7. Default result would be in /tmp directory. So you can copy the Slackware virtualbox-kernel tarball package result and keep one copy in /home/slackware/packages directory.
  8. Install the virtualbox-kernel tarball package with installpkg or pkgtool.

That's it. Now you can create new Ubuntu server virtual machine from Slackware kde. Have fun!

Ubuntu server guest in Slackware host virtualbox image

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.