14 December, 2012

Portable Virtualbox with Alpine Linux

Introduction:

I have a need for a small yet functional, portable, virtualised Linux system with a graphical web-browser, so I set-about finding one.
Firstly I needed a portable virtualisation environment (Hosting on Windows is all I need) and a small linux distribution to run on it.
I decided on using Portable-VirtualBox for the virtualisation, because it's free-of-charge, easy to download and configure (Although it seems to claim to be more portable than it actually is).
I used Alpine Linux for the guest OS distributions because it's about the most microscopic distro I've found with a moderately easy to configure GUI capability.
The install's not perfect, but it's "good enough for me". Here's the basic steps involved in this installation:

Details:

Windows applications tend to loathe relative paths. VirtualBox is no exception, it looks like it will only work with VM resources installed in fully-qualified local storage paths. It also looks like it won't work when run through a "subst" drive mapping. It might be possible to use the "net" to to do a local drive-mapping, but I need to do some research on that first.
At any rate, you need to make sure that whatever medium you're installing into mounts to the same drive-letter on every host machine you intend to run on. This is usually easy to orchestrate if you can use the disk manager tool. You may be able to make multiple VM instances using different paths to the same disk image, depending on where the host OS mounts the media.
Note that whatever machine you're running this on will still require an admin account to run the VM.

Configure the VM:

  • Ensure portable drive is mountable under the same drive letter on every host machine (I'm using "G:")
  • Install Portable-VirtualBox on the portable drive and start it there
  • Go to the "File->Preferences..." menu item and select the "General" tab

  • Make sure the "Default Machine Folder" is on your installation medium

  • Create a new virtual "Linux/Linux 2.6"machine with 1024 MB of memory and a new 640MB hard disk image

  • If you want NAT networking (So the new VM doesn't need to be visible on the host's external network), but you'd still like to be able to SSH-in from the host, set-up a port-forward for it


Download and attach one of the Alpine linux distribution ISO images and attach it to your new virtual machine.
Boot the VM to commence the installation procedure:

Install the guest OS:

  • Log-in as root once booted and issue the "setup-alpine" command
  • Follow-through the procedure taking the defaults or appropriate locale-specific values as-needed up-until the disk options are presented
  • Choose main disk device ("sda" probably) and respond with "sys" when prompted for what to do with it.
  • When complete, issue a "poweroff" command
  • Reconfigure the VM settings so the disk image is booted first (Unless you plan to manually select the boot medium or unmount the installation image).
  • Boot the machine and log-in as root again (Now running from the virtual disk image).

Configure additional packages

  • If you have the installation disk image still attached and want to use it as a software-package source, issue "mount /media/cdrom" (Otherwise everything is simply downloaded)
  • Issue "apk update"
  • Issue "apk add udev xorg-server xf86-input-evdev xf86-video-vesa xfce4 firefox" (Which will take a little while to download and install)
  • Issue "rc-update add udev sysinit"
  • Issue "rc-update add udev-postmount default"
  • Finally reboot the virtual machine again and log-in.
  • Now you should be able to issue "startx" to start the X window system and the XFCE4 desktop environment.

Final notes:

It's certainly not a perfect setup (Mainly due to the absolute path annoyance), but it works well enough for me.
My preference would have been for the Chrome/Chromium browser (Mainly for size/efficiency beliefs) but unfortunately this is not available in the Alpine Linux environment. Firefox is still fine and has come along in leaps and bounds recently.

1 comment:

  1. Hi there,

    I was reading your article and I saw this:
    "I decided on using Portable-VirtualBox for the virtualisation, because it's free-of-charge, easy to download and configure (Although it seems to claim to be more portable than it actually is)"

    I myself prefer to have portable applications on my windows keeping it clean from software installations everytime I can. For instance... Virtualbox has been one of the softwares I usually had to install.
    In this case you say Portable-Virtualbox is not as portable as it claims to bem.... why you say that? I'm considering using this portable virtualbox in a new computer... but that depends a bit if it's really portable or not.

    Thanks in advance for your reply!
    Best regards,
    Fernando

    ReplyDelete

Note: Only a member of this blog may post a comment.